Work on consolidating regexes #165

Also removed global flags from some of them (see
http://stackoverflow.com/questions/1520800/why-regexp-with-global-flag-i
n-javascript-give-wrong-results)