Re: possible bug in regex and dfa

2021-07-18 Thread arnold
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

Re: possible bug in regex and dfa

2021-07-18 Thread arnold
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

Re: possible bug in regex and dfa

2021-07-18 Thread Bruno Haible
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

Re: possible bug in regex and dfa

2021-07-18 Thread arnold
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

Re: possible bug in regex and dfa

2021-07-18 Thread Bruno Haible
> 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

Re: possible bug in regex and dfa

2021-07-16 Thread Paul Eggert
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.