Fast until you hit the catastrophic backtracking problem, and then your routing code spins indefinitely. I've hit a production issue of this form.
For this kind of problem you need to use actual regular expressions, not Perl's bastardization of the concept. Or produce your own DFA - it's not as hard as it looks, and gives you a much better idea what's going on.