in reply to regex is too long
As far as optimizing goes, since Perl uses NFA (not DFA), you'll get an efficiency boost:my $regex = join '|', map quotemeta($_), @strings; $regex = qr/$regex/;
Update: you also want to put the smaller stop-words towards the beginning of the regex, if at all possible./out|this|once|those or|about|bout/ # will work better as /th(is|ose or)|((a?)b?)out|once/
|
|---|