Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/non-4byte-chars-regex
Regular expression that matches a string with no 4-byte characters
https://github.com/shinnn/non-4byte-chars-regex
Last synced: 27 days ago
JSON representation
Regular expression that matches a string with no 4-byte characters
- Host: GitHub
- URL: https://github.com/shinnn/non-4byte-chars-regex
- Owner: shinnn
- License: unlicense
- Created: 2016-11-08T10:11:59.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-08T10:20:41.000Z (about 8 years ago)
- Last Synced: 2024-10-09T19:25:51.328Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# non-4byte-chars-regex
[![NPM version](https://img.shields.io/npm/v/non-4byte-chars-regex.svg)](https://www.npmjs.com/package/non-4byte-chars-regex)
[![Bower version](https://img.shields.io/bower/v/non-4byte-chars-regex.svg)](https://github.com/shinnn/non-4byte-chars-regex/releases)
[![Build Status](https://travis-ci.org/shinnn/non-4byte-chars-regex.svg?branch=master)](https://travis-ci.org/shinnn/non-4byte-chars-regex)
[![devDependencies Status](https://david-dm.org/shinnn/non-4byte-chars-regex/dev-status.svg)](https://david-dm.org/shinnn/non-4byte-chars-regex?type=dev)[Regular expression](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp) which matches a string with no [4-byte characters](https://github.com/shinnn/is-4byte-char/)
```javascript
/^(?:[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*$/
```## Installation
### [npm](https://www.npmjs.com/)
```
npm install non-4byte-chars-regex
```### [bower](https://bower.io/)
```
bower install non-4byte-chars-regex
```## API
### non4byteCharsRegex
Type: `RegExp`
```javascript
import non4byteCharsRegex from 'non-4byte-chars-regex';non4byteCharsRegex.test('foo'); //=> true
non4byteCharsRegex.test('bar๐ฃbaz'); //=> falsenon4byteCharsRegex.test('ๅ'); //=> true
non4byteCharsRegex.test('๐ ฎท'); //=> false
```## License
[The Unlicense](./LICENSE)