Optimized: Replaced dynamic RegExp with static ones.