[pcre-dev] [Bug 1190] New: lookaround doesn't work with star…

Top Page
Delete this message
Author: Alan Lehotsky
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 1190] New: lookaround doesn't work with startoffset
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1190
           Summary: lookaround doesn't work with startoffset
           Product: PCRE
           Version: 8.21
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: bug
          Priority: low
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: alehotsky@???
                CC: pcre-dev@???



Trying to match the pattern (from page 66 of Mastering Regular Expressions, 3rd
Edition)

(?<=\d)(?=(\d\d\d)+(?!\d)

with the source string "1234567"

This fails if my search loop uses the startoffset argument to pcre_exec() to
advance thru the search string (leaving the subject and length unchanged as I
find successive match points).

But it does work if I advance the subject ptr and decrement the length, and use
a zero for the startoffset on each call.

Is that the way it's expected to work? I'm actually surprised at that, because
it's not at all clear to me that pcre ought to be looking backwards from the
subject pointer - there's really no guarantee of what might be at a negative
offset from the start pointer.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email