1.0.52 • Published 2 months ago

xregexp-plugin-hanzi-cjk v1.0.52

Weekly downloads
2
License
ISC
Repository
github
Last release
2 months ago

xregexp-plugin-hanzi-cjk

add regexp-cjk plugin for xregexp, make xregexp auto match chinese/japanese hanzi.

see regexp-cjk

demo

import addSupportToXRegExp, { IOptions, createXRegExp } from 'xregexp-plugin-hanzi-cjk';
import XRegExp from 'xregexp';
let options: IOptions = {
	// set a flag if u only wanna trigger for this plugin, default is auto enable
	//flags: 'u',
};

console.log(XRegExp.version);

// if didn't set xr, it is XRegExp
const xr1 = addSupportToXRegExp(null, options);
//const xr2 = addSupportToXRegExp(XRegExp, options);
//console.log('xr1 = xr2 = XRegExp', xr1 === xr2);

// XRegExp only work when input pattern is string
let r1 = '(の|像)';
let r2 = /(の|像)/;

let x1 = xr1(r1);

console.log(x1);
console.log(x1.test('象'));
console.log(x1.test('的'));

// this allow u input a RegExp
let x3 = createXRegExp(r2);

console.log(x3);
console.log(x3.test('象'));
console.log(x3.test('的'));

// @BUG current XRegExp not support input pattern ia a RegExp object
let x2 = xr1(r2);

console.error(x2);
console.error(x2.test('象'));
console.error(x2.test('的'));

output

4.1.1
{ /([の之的]|[像象])/ xregexp: { captureNames: null, source: '(の|像)', flags: '' } }
true
true
{ /([の之的]|[像象])/ xregexp: { captureNames: null, source: '(の|像)', flags: '' } }
true
true
{ /(の|像)/ xregexp: { captureNames: null, source: null, flags: null } }
false
false
1.0.52

2 months ago

1.0.51

2 months ago

1.0.50

3 months ago

1.0.49

1 year ago

1.0.48

2 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.0.44

2 years ago

1.0.42

2 years ago

1.0.45

2 years ago

1.0.39

2 years ago

1.0.41

2 years ago

1.0.36

3 years ago

1.0.35

3 years ago

1.0.34

3 years ago

1.0.33

3 years ago

1.0.32

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.30

3 years ago

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.4

4 years ago

1.0.0

6 years ago