in reply to Re^4: the case where regex seems to work slower
in thread the case where regex seems to work slower

The spaces are there to split the target string into three parts, before the '*', the star part, and after the star. This prevents trying to match with a pattern equivalent to /a*a*/ which causes the long matching time you were seeing;

  • Comment on Re^5: the case where regex seems to work slower