use regular expressions rather than touching String.prototype
optimize code a little
Revert some of the changes.
Merge branch 'nickdesaulniers-microOpts'