in reply to why this regular expression is so slow?

It's slow because the quantified char classes can match a zero-width string, thus causing a massive amount of backtracking.

If you give us a verbal description of what you want to achieve, maybe we can come up with a better solution that involves less backtracking.

  • Comment on Re: why this regular expression is so slow?