Hi.
Bruno Haible wrote:
> - if REG_NEWLINE is not set, '.' matches newline but '^' does not match
> after the newline.
This is indeed the desired behavior, but regex isn't following it.
REG_NEWLINE being set gets translated into preg->newline_anchor.
Starting at line 620, regexec.c rel
Bruno Haible wrote:
> Hi Arnold,
>
> > Dot matching newline isn't the issue here.
> >
> > It's ^ matching in the middle of a string. For my purposes, ^ should
> > only match at the beginning of a *string* (as $ should only match at
> > the end of a string). I haven't rechecked POSIX, but this
Hi Arnold,
> Dot matching newline isn't the issue here.
>
> It's ^ matching in the middle of a string. For my purposes, ^ should
> only match at the beginning of a *string* (as $ should only match at
> the end of a string). I haven't rechecked POSIX, but this is how awk
> has behaved since fore
Hi.
Paul Eggert wrote:
> On 7/15/21 1:48 PM, Arnold Robbins wrote:
> > The regexp used there, ".^", to my mind should be treated as invalid.
>
> No, that regular expression is valid because "." matches newline in
> POSIX EREs. So the "." matches a newline, and the following "^" matches
> the s
> No, that regular expression is valid because "." matches newline in
> POSIX EREs.
And if you don't like this, you need to remove the RE_DOT_NEWLINE flag from
the value that you pass to re_set_syntax.
Bruno
On 7/15/21 1:48 PM, Arnold Robbins wrote:
The regexp used there, ".^", to my mind should be treated as invalid.
No, that regular expression is valid because "." matches newline in
POSIX EREs. So the "." matches a newline, and the following "^" matches
the start of the next line.