Some regex optimizations