--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/progs/catastrophic.js Thu Nov 29 02:37:01 2018 +0000
@@ -0,0 +1,28 @@
+
+
+
+// A case of catastrophic backtracking in JavaScript/Node.js
+//
+// regex: (a*)*b
+// strings: aa...
+//
+// call with:
+//
+// $> node catastrophic.py 20
+//
+// call with timing as:
+//
+// $> time node catastrophic.py 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)