in reply to search a regex list
Also:
>perl -wMstrict -le "my ($patterns) = map qr{$_}xms, join ' | ', qw(catalina\.properties \.key$ tomcat-users\.xml) ; ;; print $patterns; ;; my $string = 'foo.key'; print 'match' if $string =~ $patterns; " (?msx-i:catalina\.properties | \.key$ | tomcat-users\.xml) match
Update: A small subtlety: The use of the /m regex modifier in the qr{$_}xms regex in the example above causes the $ assertion (see Metacharacters) to match before any embedded newline in the string or before the absolute end of the string. If a match only at the absolute end of string is desired, use \z instead (see Assertions).
|
|---|