in reply to Fast searching of multiple substrings in a string

Regexp::Optimizer could be of help. It turns /bar|baz/ into /ba[rz]/, which is supposed to run faster.