morgon has asked for the wisdom of the Perl Monks concerning the following question:
assume I have a list of "simple enough" regexes (in the sense that they don't contain any backrefs, embedded code or the like).
Is it possible to decide (and if so what would be a good algorithm for that) that every possible string matches only against at most one regex in the list - or put another way that no possible string would match against 2 or more regexes of the list.
So I want an algorithm that takes a list of regexes and decides whether these regexes are mutual exclusive in the sense that no string would ever match against more than 1 regex of the list.
Any ideas?
Many thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: mutual exclusion of regexes
by blokhead (Monsignor) on Apr 14, 2009 at 00:02 UTC | |
|
Re: mutual exclusion of regexes
by Bloodnok (Vicar) on Apr 14, 2009 at 11:22 UTC |