Sha256: 4349d4b83ad9acdd1b61f3dda835fb5fc2b46dce24dc853a9024daa841aee952

Contents?: true

Size: 859 Bytes

Versions: 90

Compression:

Stored size: 859 Bytes

Contents

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

> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)


## Install

```sh
$ npm install --save ansi-regex
```


## Usage

```js
var ansiRegex = require('ansi-regex');

ansiRegex().test('\u001b[4mcake\u001b[0m');
//=> true

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)

Version data entries

90 entries across 27 versions & 6 rubygems

Version Path
webpack_rails-2.0.1 lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
webpack_rails-2.0.0 lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
webpack_rails-1.3.1 lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
webpack_rails-1.3.0 lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
webpack_rails-1.2.2 lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
webpack_rails-1.2.1 lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
webpack_rails-1.2.0 lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
webpack_rails-1.1.1 lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
webpack_rails-1.1.0 lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
webpack_rails-1.0.1 lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
webpack_rails-1.0.0 lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
eslint_node_modules-1.6.0.1 vendor/node_modules/eslint/node_modules/inquirer/node_modules/readline2/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
eslint_node_modules-1.6.0 vendor/node_modules/eslint/node_modules/inquirer/node_modules/readline2/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
gulp_assets-1.0.0.pre.5 template/node_modules/gulp-rev-replace/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md
gulp_assets-1.0.0.pre.5 template/node_modules/gulp-livereload/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md
gulp_assets-1.0.0.pre.5 template/node_modules/gulp-livereload/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
gulp_assets-1.0.0.pre.5 template/node_modules/gulp-rev-replace/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
gulp_assets-1.0.0.pre.5 template/node_modules/webpack-dev-server/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
gulp_assets-1.0.0.pre.4 template/node_modules/gulp-livereload/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
gulp_assets-1.0.0.pre.4 template/node_modules/gulp-rev-replace/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md