pulled compiled regular expressions out of the global scope

This optimisation is not needed since 0441192.