Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

variation-selector-regex

1.0.0 • Public • Published

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.

Install

npm i variation-selector-regex

DownloadsWeekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar