in reply to Regex help
Regexp::Optimizer might be of use if @list is long.my $super_regex = join '|', sort {length $b <=> length $a} map quoteme +ta($_), @list; $var_val =~ s/($super_regex)/$prefix$1$suffix/g;
Update: added quotemeta as per ikegami's note.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex help
by ikegami (Patriarch) on Jun 02, 2005 at 18:18 UTC | |
|
Re^2: Regex help
by snacktime (Sexton) on Jun 02, 2005 at 17:59 UTC |