1.0.0 • Published 8 years ago

non-4byte-chars-regex v1.0.0

Weekly downloads
181
License
MIT
Repository
github
Last release
8 years ago

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