Ok I'm back with a bloody nose but still standing (just)
I've completely re-factored the rewriter to handle different states. The regex is handled by a small state machine to fix lax browser parsers and stop bad syntax inside regex character classes. I also detect E4X and prevent it from being executed.

I really appreciate all your help thanks! Please break me again :D this time I should be better prepared for the battle