general RegExp optimizations

general RegExp optimizations


I did have a quick look through the code and see that most of the
(small) regular expressions are not cached and referenced but defined
in-line in the conditionals/replacements.
For example these are repeatedly used in various place:
/\s+/
/\\/g
/\?/
I believe there are improvements in both speed and readability of code
by caching them compiled.
Is there some reason I don't know in not defining some constants like
TRIM, SQUEEZE, ESCAPE etc... ?
Diego