variation-selector-regex
v1.0.0
Published
Create a regular expression for Unicode variation selectors
Downloads
10
Maintainers
Readme
variation-selector-regex
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.