Replaced 'newline' regex with faster plain javascript

I find this 3-4% faster on Chrome and some other engines