Fix regex to work in all circumstances.