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
|
16 | const astralRegex = require('astral-regex');
|
17 |
|
18 | astralRegex({exact: true}).test('🦄');
|
19 | //=> true
|
20 |
|
21 | 'foo 🦄 💩 bar'.match(astralRegex());
|
22 | //=> ['🦄', '💩']
|
23 | ```
|
24 |
|
25 |
|
26 | ## API
|
27 |
|
28 | ### astralRegex([options])
|
29 |
|
30 | Returns a `RegExp` for matching astral symbols.
|
31 |
|
32 | #### options
|
33 |
|
34 | Type: `Object`
|
35 |
|
36 | ##### exact
|
37 |
|
38 | Type: `boolean`<br>
|
39 | Default: `false` *(Matches any astral symbols in a string)*
|
40 |
|
41 | Only match an exact string. Useful with `RegExp#test()` to check if a string is a astral symbol.
|
42 |
|
43 |
|
44 | ## License
|
45 |
|
46 | MIT © [Kevin Mårtensson](https://github.com/kevva)
|