Socket
Socket
Sign inDemoInstall

ansi-regex

Package Overview
Dependencies
0
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.2.0

4

index.js
'use strict';
module.exports = /\x1B\[([0-9]{1,3}(;[0-9]{1,3})*)?[m|K]/g;
module.exports = function () {
return /\u001b\[([0-9]{1,3}(;[0-9]{1,3})*)?[m|K]/g;
};
{
"name": "ansi-regex",
"version": "0.1.0",
"version": "0.2.0",
"description": "Regular expression for matching ANSI escape codes",

@@ -42,3 +42,7 @@ "license": "MIT",

"regexp",
"re"
"re",
"match",
"test",
"find",
"pattern"
],

@@ -45,0 +49,0 @@ "devDependencies": {

@@ -18,12 +18,17 @@ # ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex)

ansiRegex.test('\x1b[4mcake\x1b[0m');
ansiRegex().test('\u001b[4mcake\u001b[0m');
//=> true
ansiRegex.test('cake');
ansiRegex().test('cake');
//=> false
'\u001b[4mcake\u001b[0m'.match(ansiRegex());
//=> ['\u001b[4m', '\u001b[0m']
```
*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.*
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc