Move regexp initialization out of loop. Serious performance issue