Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including astral-regex with all npm packages installed. Try it out:

var astralRegex = require("astral-regex")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

astral-regex v2.0.0

Regular expression for matching astral symbols

astral-regex Build Status

Regular expression for matching astral symbols

Install

$ npm install astral-regex

Usage

const astralRegex = require('astral-regex');

astralRegex({exact: true}).test('🦄');
//=> true

'foo 🦄 💩 bar'.match(astralRegex());
//=> ['🦄', '💩']

API

astralRegex([options])

Returns a RegExp for matching astral symbols.

options

Type: Object

exact

Type: boolean
Default: false (Matches any astral symbols in a string)

Only match an exact string. Useful with RegExp#test() to check if a string is a astral symbol.

License

MIT © Kevin Mårtensson

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free