3 ms·
Agreed, regular expressions are not turing complete and they can still make your browser ponder for a bit if carefully crafted. Try /(x+x+)+y/.test('xxxxxxxx
by madflame991 11y ago
Agreed, regular expressions are not turing complete and they can still make your browser ponder for a bit if carefully crafted. Try
/(x+x+)+y/.test('xxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
for instance. This regex doesn't even use non-regular extensions; it's expressible in a very limited computational model, it fits in a tweet and yet it renders my browser unresponsive.
I can do even more damage with a nasty shader; GLSL is not turing complete either (in fact it looks a lot like Crema).
- schoen 11y agoThat's a nice example.
- black_knight 11y agoWell, there are faster implementations of regexp than the one your browser most likely is using [1]. [1] http://swtch.com/~rsc/regexp/regexp1.html http://swtch.com/~rsc/regexp/regexp1.html