[pcre-dev] [Bug 1490] Awkward semantics of anchored patterns…

Top Page
Delete this message
Author: Zoltan Herczeg
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 1490] Awkward semantics of anchored patterns with lookbehind assertions
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1490

Zoltan Herczeg <hzmester@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hzmester@???





--- Comment #3 from Zoltan Herczeg <hzmester@???> 2014-06-07 19:08:18 ---
> True, but if the offset is non-zero, the matching engine may still "look
> behind" the startoffset. This is actually documented in the man page, but I
> didn't know about this behavior until a user filed a bug report for his
> peculiar pattern.


This is the exact purpose of startoffset, to allow look behind assertions. If
you don't want to match them just add the offset to the start, and substract it
from length.

> I initially wanted to avoid this, because it required some non-trivial changes
> to my bindings and seemed like an easy flag to add to PCRE. OCaml doesn't
> allow you to do pointer arithmetic on strings for safety reasons so I had to
> pass through an extra offset each time my code needs to call pcre_exec and then
> rewrite the results in "ovector" after matching and before callouts.


Safety reasons :) Anyway I would recommend a small wrapper in C before
pcre_exec.


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