[pcre-dev] [Bug 1099] Ability to reference 'variables' from …

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 1099] Ability to reference 'variables' from regexp
------- You are receiving this mail because: -------
You are on the CC list for the bug.

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




--- Comment #4 from Philip Hazel <ph10@???> 2011-03-25 16:01:18 ---
On Fri, 25 Mar 2011, Pavel Kostromitinov wrote:

> I understand that this is not an easy change - requiring some 'data injection'
> inside pcre_exec().
>
> I can probably try to implement it myself, after some research into its
> internal workings, especially to where and how are back-referenced strings are
> stored.


Back references are to capturing subpatterns: they are stored exactly as
they are returned to the user. They are identified in the compiled
pattern only by number, not by name. This will make it very difficult
for you. You will have to modify pcre_compile() to set up some
references to some unused numbers as well as modifying pcre_exec() to
handle these numbers. If you want to do this, start by looking at the
function match_ref() in pcre_exec.c and the places where it is called.

An alternative to this might be for you to use callouts. Take a look at
"man pcrecallout" if you have not already done so.

Philip


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