Hello all,
I've got a tricky puzzle.
Imagine I have a bunch of n RegExps r[] - they could be any valid ruby Regexps.
Say I want to match each of them in turn to a certain something s to
make sure that no two Regexps in the list both match s.
Now say that I want a meta regular expression m that is all the
Regexps merged together so that the following pseudo code wroks,
m = MetaRegExp.new
for each r { [i] m.add(r[i]) } # add makes sure that no two RegExps
would match the same input
m =~ s # returns an int representing which of the n original RegExps
would have matched
Any ideas? Is this possible? If not I will have to code it in C and I
would have to code the RegExp stuff from scratch, which fills me with
fear...
Thanks in advance,
Anthony
(I hope I have explained myself clearly)