4 ms·
Another important dimension when evaluating these regexes is performance. The Gruber v2 regex has exponential (?) behavior on certain pathological inputs (at l
by bdarnell 12y ago
Another important dimension when evaluating these regexes is performance. The Gruber v2 regex has exponential (?) behavior on certain pathological inputs (at least in the python re module).
There are some examples of these pathological inputs at
https://github.com/tornadoweb/tornado/blob/master/tornado/test/escape_test.py#L20-29 https://github.com/tornadoweb/tornado/blob/master/tornado/te...
- keeperofdakeys 12y agoFrom experience, the python re module does weird things sometimes. There is a better third-party regex module, https://pypi.python.org/pypi/regex https://pypi.python.org/pypi/regex.
- pipeep 12y agoDoes it use NFA? http://swtch.com/~rsc/regexp/regexp1.html http://swtch.com/~rsc/regexp/regexp1.html Because the issue with the URL regex mentioned is with backtracking.
- pipeep 12y agoIn node.js too. I found this out the hard way. I ended up modifying it so that it didn't work as well, but at least stopped DoSing my service: https://github.com/PiPeep/NotVeryCleverBot/blob/coffee-rewrite/src/transform/indexer.coffee#L58 https://github.com/PiPeep/NotVeryCleverBot/blob/coffee-rewri... Note the commented out lines in the here-regex.