[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Peter Boughton
Subject: Re: PCRE
Date: Fri, 2 Jun 2023 17:37:17 +0100

Unless I'm missing messages, the original thread is before I subscribed to this list? It is a shame the quote omitted name and date.


On 02/06/2023 14:59, Sebastian Carlos wrote:
I want to point out something that may have been missed at first:

Grep's PCRE support (grep -P) does not include the multi-line processing
features, Therefore I think that shouldn't be an impediment to implement
PCRE support in sed.

According to Grep manual, 2.4 "grep Programs":

By default, grep applies each regexp to a line at a time, so the [PCRE]
‘(?s)’ directive (making ‘.’ match line breaks) is generally ineffective.

Checking both "man grep" on Debian and the PDF manual I have to hand (GNU Grep v3.4), neither of them contain that text. Nor does a quick search of the grep source for "generally ineffective" return any results.

One can easily demonstrate that it *is* effective:

$ echo -e 'abc\na\nc' | grep -zoP 'a.c'

$ echo -e 'abc\na\nc' | grep -zoP '(?s)a.c'

However, even if it didn't work, it wouldn't really be relevant - with or without newline-related features there is no need for PCRE in Sed when one can just use Perl.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]