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 400,000 packages pre-installed, including variation-selector-regex with all npm packages installed. Try it out:

var variationSelectorRegex = require("variation-selector-regex")

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

variation-selector-regex v1.0.0

Create a regular expression for Unicode variation selectors

variation-selector-regex

NPM version Bower version Build Status devDependencies Status

Create a regular expression for Unicode variation selectors

import variationSelectorRegex from 'variation-selector-regex';

variationSelectorRegex(); //=> /([\u180B-\u180D\uFE00-\uFE0F]|\uDB40[\uDD00-\uDDEF])/g

Installation

npm

npm install variation-selector-regex

bower

bower install variation-selector-regex

API

variationSelectorRegex()

Return: RegExp

It returns a RegExp instance that matches all variation selectors in a string.

import variationSelectorRegex from 'variation-selector-regex';

'*☀︎☀️'.match(variationSelectorRegex()); //=> ['\uFE0E', '\uFE0F']

Acknowledgements

The regular expression used in this module is copied from mathiasbynens/strip-variation-selectors. Thanks, Mathias Bynens.

Licenses

mathiasbynens/strip-variation-selectors

strip-variation-selectors is available under the MIT license.

variation-selector-regex

Copyright (c) 2016 Shinnosuke Watanabe

Licensed under the MIT License.

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