|RegEx: AND operator email@example.com (jan) (2003-10-12)|
|Re: RegEx: AND operator firstname.lastname@example.org (2003-10-13)|
|Re: RegEx: AND operator email@example.com (2003-10-13)|
|Re: RegEx: AND operator firstname.lastname@example.org (2003-10-14)|
|Re: RegEx: AND operator email@example.com (Clint Olsen) (2003-10-14)|
|Re: RegEx: AND operator firstname.lastname@example.org (jan) (2003-10-18)|
|Re: RegEx: AND operator email@example.com (jan) (2003-10-19)|
|From:||firstname.lastname@example.org (Henry Spencer)|
|Date:||14 Oct 2003 23:44:09 -0400|
|Organization:||SP Systems, Toronto, Canada|
|Posted-Date:||14 Oct 2003 23:44:09 EDT|
jan <email@example.com> wrote:
>The algorithms for translation of regex into NFA are popular; however,
>in none have I seen support for the AND (&) operator...
If you are willing to use NFA->DFA conversions, you can preprocess it out,
exploiting the identity x&y == ~(~x | ~y) and the straightforward DFA
implementation of the NOT operator.
>It might be
>implemented as another NFA that is run in the required range
>(eg. regex (a.* & ~abc)+ would make one NFA (a.*)+ and for each
>matched (a.*) it would test the other NFA: ~abc) but that's not a good
With DFAs, or DFA simulation via a state set -- with any matching
algorithm that tracks all possible states simultaneously -- you can run
two matchers in parallel. You advance both of them one character at a
time, looking for a character where they both match or one of them
declares complete failure.
But with a backtracking implementation, as far as I know, there just
is no graceful way of implementing AND.
MOST launched 1015 EDT 30 June, separated 1046, | Henry Spencer
first ground-station pass 1651, all nominal! | firstname.lastname@example.org
Return to the
Search the comp.compilers archives again.