npm.io
1.0.0 • Published 9 years ago

non-4byte-chars-regex

Licence
MIT
Version
1.0.0
Deps
0
Vulns
0
Weekly
0

non-4byte-chars-regex

NPM version Bower version Build Status devDependencies Status

Regular expression which matches a string with no 4-byte characters

/^(?:[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*$/

Installation

npm

npm install non-4byte-chars-regex
bower
bower install non-4byte-chars-regex

API

non4byteCharsRegex

Type: RegExp

import non4byteCharsRegex from 'non-4byte-chars-regex';

non4byteCharsRegex.test('foo'); //=> true
non4byteCharsRegex.test('bar🍣baz'); //=> false

non4byteCharsRegex.test('吉'); //=> true
non4byteCharsRegex.test('𠮷'); //=> false

License

The Unlicense

Keywords