Not that it matters, or has much effect on performance, but you don't need use [] brackets for a single character in regexp:
code:
/([\\]*)!(\w+|#)/g
is identical to:
code:
/(\\*)!(\w+|#)/g
I did a little benchmark, and in 1 sec first regexp was executed 180499 times, and second 185191 times (2.6% increase). Not much, but why not?
or
code:
/[\\]+/g
vs
code:
/\\+/g
Benchmark: 316126 vs 326921 (3.4% increase)