cjk-regex

3.1.0 • Public • Published

cjk-regex

npm build

regular expression for matching CJK text

Changelog

Install

npm install cjk-regex

Usage

import * as cjk from 'cjk-regex'

const cjkCharset = cjk.all()
cjkCharset.toRegExp().test('a') //=> false
cjkCharset.toRegExp().test('。') //=> true
cjkCharset.toRegExp().test('中') //=> true

const cjkLetterCharset = cjk.letters()
cjkLetterCharset.toRegExp().test('a') //=> false
cjkLetterCharset.toRegExp().test('。') //=> false
cjkLetterCharset.toRegExp().test('中') //=> true

const cjkPunctuationCharset = cjk.punctuations()
cjkPunctuationCharset.toRegExp().test('a') //=> false
cjkPunctuationCharset.toRegExp().test('。') //=> true
cjkPunctuationCharset.toRegExp().test('中') //=> false

Returns a Charset.

Development

# lint
pnpm run lint

# build
pnpm run build

# test
pnpm run test

License

MIT © Ika

Readme

Keywords

Package Sidebar

Install

npm i cjk-regex

Weekly Downloads

17,738

Version

3.1.0

License

MIT

Unpacked Size

6.69 kB

Total Files

6

Last publish

Collaborators

  • ikatyang