http://qs321.pair.com?node_id=601813


in reply to Re^3: Regex solution needed
in thread Regex solution needed

The \s should probably be \s+, and

(?! \s+ fan ) (?! \s+ game ) (?! \s+ score ) (?! \s+ player )
is slower than
(?! \s+ (?: fan | game | score | player ) )

This factors out the constant \s+, and it uses | which probably has a lower overhead than (?!...). Furthermore, alternations of constant strings can be highly optimized by re engine modifications demerphq added to 5.9. (I don't think those particular strings can be optimized, though.)