export default function ansiRegex({onlyFirst = false} = {}) {
	const pattern = [
		'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
		'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
	].join('|');

	return new RegExp(pattern, onlyFirst ? undefined : 'g');
}

@@ -75,17 +75,20 @@
 rn = %5B%0A%09
-%09
+    
 '%5B%5C%5Cu001
@@ -117,17 +117,22 @@
 ?:(?:(?:
-%5B
+(?:;%5B-
 a-zA-Z%5C%5C
@@ -132,18 +132,46 @@
 -zA-Z%5C%5Cd
-%5D*
+%5C%5C/#&.:=?%25@~_%5D+)*%7C%5Ba-zA-Z%5C%5Cd%5D+
 (?:;%5B-a-

Fix potential ReDoS (#37)