in reply to Re: efficient method of matching a string against a list of substrings?
in thread efficient method of matching a string against a list of substrings?
You should realise that large numbers of alternations are processed in perl's regular expression engine in O(n) time, not O(1). If you are still having performance problems, you should look at using a trie.regexes are often more convenient, rather than efficient. but thanks for pointing me there, because the note also mentions:
... Perl's own regular expression engine will implement trie optimisations in perl 5.10 (they are already available in perl 5.9.3 if you want to try them out).this would probably solve the problem in the future, but i need to find something for the present.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: efficient method of matching a string against a list of substrings?
by demerphq (Chancellor) on May 05, 2005 at 13:19 UTC |