Regex adjustments and optimizations