In this case, it would appear that they are all the same length, but in general, the list should be sorted longest-first, so that @list=qw/foo bar foobar/ will ever match foobar.my $re = do { local $" = '|'; qr/^@{[map {quotemeta} @list]}$/; };
In reply to Re^2: build regexp on a list of patterns
by ysth
in thread build regexp on a list of patterns
by mod_alex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |