On Mon, 9 Mar 2009, Jing Lan wrote:
> I was guessing there might be some in-compatible issue. Yet the result I got
> from my trial set seems not correct. If I make a rule with callout as:
> (test(?C1)) $0=ENTITY:callout:ADV/ADV
I don't understand. What program are you using? What is ENTITY? What is
"ADV/ADV"? I am guessing you are using some program that calls PCRE.
Your pattern (test(?C1)) will match the string "test", and then do the
callout. Othewise it will not call out.
> And my testing data has a line as:
> a testcallOUT AND and testCALLOUT and friday
>
> With my patch, I got
> a <dnt_entity_callout pos="ADV/ADV">testcall</dnt_entity_callout>OUT AND and
> <dnt_entity_callout pos="ADV/ADV">testCALL</dnt_entity_callout>OUT and friday
Again, I do not understand. What is "dnt_entity_callout"? It is not part
of PCRE.
> Without it, I got
> a <dnt_entity_callout pos="ADV/ADV">test</dnt_entity_callout>callOUT AND and
> <dnt_entity_callout pos="ADV/ADV">test</dnt_entity_callout>CALLOUT and friday
> It seems the pattern is correctly found, yet the end of re-writinng
> location is not correctly calculated.
Who is re-writing? PCRE has no facilities for re-writing. It must be the
application that you are using.
I tried your pattern with pcretest, and it gives the right answer:
PCRE version 7.8 2008-09-05
/(test(?C1))/g
testcallout and testCALLOUT and friday
--->testcallout and testCALLOUT and friday
1 ^ ^ )
0: test
1: test
1 ^ ^ )
0: test
1: test
The lines with ^ are where the callouts happened; they show that PCRE
has matched the string "test", as expected, when the callout is obeyed.
(The ")" at the end is the remainder of the pattern that has still to be
obeyed.)
Philip
--
Philip Hazel