in reply to pattern match, speed problem
my $re = join '|', @probes; $re = qr{(?:$re)}; # just in case you want to use it # somewhere else, and now it's compiled.
And make sure that you use perl 5.10, which has a special optimization in the regex engine for alternations of fixed strings.
Note that this won't find overlapping match results, if you need them, you have to fiddle with pos (and perhaps \G in the regex) manually.
It will also modify the order in which the matches are returned, but if you need the original order very badly, you can find ways around it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: pattern match, speed problem
by BrowserUk (Patriarch) on Feb 20, 2008 at 13:13 UTC | |
by moritz (Cardinal) on Feb 20, 2008 at 13:24 UTC | |
by BrowserUk (Patriarch) on Feb 20, 2008 at 14:13 UTC |