non-4byte-chars-regex

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i non-4byte-chars-regex

Weekly Downloads

308

Version

1.0.0

License

MIT

Last publish

Collaborators

  • shinnn