diff -r 923b946347e6 -r e66bd5c563eb progs/catastrophic.js --- a/progs/catastrophic.js Mon Jul 27 01:55:05 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ - - - -// A case of catastrophic backtracking in JavaScript/Node.js -// -// regex: (a*)*b -// strings: aa... -// -// call with: -// -// $> node catastrophic.js 20 -// -// call with timing as: -// -// $> time node catastrophic.js 25 - - -const args = process.argv[2] - -var str = 'a'.repeat(args); - -console.log(str) - -var re = /^((a)*)*b$/; - -var res = re.test(str); - -console.log(res)