Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cjk-regex

ikatyang-collab182.9kMIT3.3.0TypeScript support: included

regular expression for matching CJK text

cjk, regular-expression

readme

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

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

3.3.0 (2025-03-10)

Features

3.2.1 (2025-03-08)

3.2.0 (2025-03-07)

Bug Fixes

Features

  • upgrade unicode-regex to support Unicode 16 (#191) (5e5757e)

3.1.0 (2023-10-21)

Features

3.0.0 (2023-07-09)

Build System

BREAKING CHANGES

  • this package is now pure ESM

2.0.1 (2021-01-07)

Bug Fixes

2.0.0 (2018-03-22)

Features

BREAKING CHANGES

  • rename .characters() with .letters()
  • functions are now returning a Charset

1.0.2 (2017-10-14)

Documentations

  • readme: fix example (2b272f4)
  • description: replace texts with text (204b480)

1.0.1 (2017-10-13)

1.0.0 (2017-10-13)

Features