Reverted a change I made previously - it causes too many problems

I'll find a better solution, but until then, I've changed this regex back to how it used to be