[Bug regex/26653] New: regex mishandles \b inside interval expressions

eggert at cs dot ucla.edu sourceware-bugzilla@sourceware.org
Wed Sep 23 00:38:44 GMT 2020


https://sourceware.org/bugzilla/show_bug.cgi?id=26653

            Bug ID: 26653
           Summary: regex mishandles \b inside interval expressions
           Product: glibc
           Version: 2.32
            Status: NEW
          Severity: normal
          Priority: P2
         Component: regex
          Assignee: unassigned at sourceware dot org
          Reporter: eggert at cs dot ucla.edu
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Created attachment 12855
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12855&action=edit
test program illustrating the \b-inside-interval regex bug

The glibc regular expression code mishandles extended regular expressions such
as:

  (.*\band){2}

although it correctly processes equivalent expressions such as:

  (.*(\<|\>)and){2}

There is a similar problem with the same regular expression in BRE syntax:

  \(.*\band\)\{2\}

To reproduce the problem, compile and run the attached file b-interval-bug.c.
It will exit with status 1, whereas the correct exit status is 0.

This bug was reported against GNU 'sed' here:

https://bugs.gnu.org/41558

and the original posting is from StackExchange, here:

https://unix.stackexchange.com/questions/579889/why-doesnt-this-sed-command-replace-the-3rd-to-last-and

The original posting mentions backreferences but the bug occurs even without
backreferences.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list