3 ms·
Easy to reproduce [1]. Just remove the a in the end and your timeout disappears. Anybody knows which regex engine they used? [1] http://regexr.com/3drn3 http:/
by grashalm 10y ago
Easy to reproduce [1]. Just remove the a in the end and your timeout disappears. Anybody knows which regex engine they used?
[1] http://regexr.com/3drn3 http://regexr.com/3drn3
- jandrese 10y agoI had a tough time reproducing it in Perl, although I think I managed to get it. % perl -v This is perl 5, version 18, subversion 2 (v5.18.2) built for x86_64-linux-gnu-thread-multi % ls -l testfile 125380092 Jul 20 16:41 testfile % time ./regextest testfile ./regextest testfile 0.36s user 0.03s system 99% cpu 0.398 total (Remove the a at the end) % time ./regextest testfile ./regextest testfile 0.13s user 0.03s system 99% cpu 0.156 total I had to make a much larger input file than I expected before I was able to really see the difference. Given the O(n^2) nature of the bug, I was expecting it to take much longer.
- deadowl 10y agoI wanted to figure that out. I found a meta post stating the SO uses C#, so that might narrow it down.
- hehheh 10y agoI could not reproduce the slowness in Perl, but I could in JavaScript (specifically node.js). There are many, many modules that use /\s+$/, including at least one form validator.