Regex optimizations