[pcre-dev] [Bug 1372] We have OR (alternates). How about AND…

Página superior
Eliminar este mensaje
Autor: Philip Hazel
Fecha:  
A: pcre-dev
Asunto: [pcre-dev] [Bug 1372] We have OR (alternates). How about AND and NOT?
------- You are receiving this mail because: -------
You are on the CC list for the bug.

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




--- Comment #6 from Philip Hazel <ph10@???> 2013-07-28 11:31:54 ---
(In reply to comment #5)

> My thinking was that implementing such additions won't be that onerous, the
> reason being that there is already an implementation for alternation. The
> difference is that, in alternation, subexpressions (alternates) are executed
> left to right against the subject text until one succeeds, or all fail
> (implementing a boolean OR), while a boolean AND involves executing alternates
> left to right against the subject text until one fails, or all succeed. So it's
> rather the way to compound the partial results that differs, than the way to
> compute them.


The implementation isn't quite like that. For something like (A|B|C)D it will
immediately go on to check D once A succeeds; only if D fails will it back up
to try B. To implement AND would mean stopping after matching A and checking B
and C before moving on to D. This is similar to what happens for a lookahead,
however (which is not surprising, since you can get the AND behaviour using
lookaheads).

> I am sure that you know better what are the priorities, and just want to take
> the opportunity to say a big THANK YOU for the wonderful tool you are offering
> to so many to help us accomplish what we need to accomplish.


Thank you. Maybe once we have got the new API sorted out I might find time to
research what other regex packages do about AND.


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