UNPKG

839 BMarkdownView Raw
1# astral-regex [![Build Status](https://travis-ci.org/kevva/astral-regex.svg?branch=master)](https://travis-ci.org/kevva/astral-regex)
2
3> Regular expression for matching [astral symbols](https://everything2.com/title/astral+plane)
4
5
6## Install
7
8```
9$ npm install astral-regex
10```
11
12
13## Usage
14
15```js
16const astralRegex = require('astral-regex');
17
18astralRegex({exact: true}).test('🦄');
19//=> true
20
21'foo 🦄 💩 bar'.match(astralRegex());
22//=> ['🦄', '💩']
23```
24
25
26## API
27
28### astralRegex([options])
29
30Returns a `RegExp` for matching astral symbols.
31
32#### options
33
34Type: `Object`
35
36##### exact
37
38Type: `boolean`<br>
39Default: `false` *(Matches any astral symbols in a string)*
40
41Only match an exact string. Useful with `RegExp#test()` to check if a string is a astral symbol.
42
43
44## License
45
46MIT © [Kevin Mårtensson](https://github.com/kevva)