cjk-regex
v3.1.0
Published
regular expression for matching CJK text
Downloads
181,213
Readme
cjk-regex
regular expression for matching CJK text
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