Fix strange issue on iOS 7 where a simple regular expression appears to cause a complete browser crash.

Closes #306.