in reply to Assessing the complexity of regular expressions

How about something simple? Count the meta characters, assigning a score to each of them if you want to be fancy. \d is 1, [0-9] is 3 ('[', '-' and ']'), (0|1|2|3|4|5|6|7|8|9) is 11. And yes \\ is 2, and so is \+

That would give you a simple to compute, yet, I think, vaguely adequate number to assign to each regexp.

  • Comment on Re: Assessing the complexity of regular expressions