summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/table/node_modules/ansi-regex/index.js
blob: 76d354a9afffd0d0a0966d1029ac886fc678fe77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'use strict';

module.exports = options => {
	options = Object.assign({
		onlyFirst: false
	}, options);

	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, options.onlyFirst ? undefined : 'g');
};