1.0.55 • Published 2 years ago
xregexp-plugin-hanzi-cjk v1.0.55
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
false1.0.55
2 years ago
1.0.54
2 years ago
1.0.53
2 years ago
1.0.52
2 years ago
1.0.51
2 years ago
1.0.50
2 years ago
1.0.49
3 years ago
1.0.48
3 years ago
1.0.47
3 years ago
1.0.46
4 years ago
1.0.44
4 years ago
1.0.42
4 years ago
1.0.45
4 years ago
1.0.39
4 years ago
1.0.41
4 years ago
1.0.36
4 years ago
1.0.35
5 years ago
1.0.34
5 years ago
1.0.33
5 years ago
1.0.32
5 years ago
1.0.29
5 years ago
1.0.28
5 years ago
1.0.30
5 years ago
1.0.27
5 years ago
1.0.26
5 years ago
1.0.25
5 years ago
1.0.24
5 years ago
1.0.23
6 years ago
1.0.22
6 years ago
1.0.21
6 years ago
1.0.20
6 years ago
1.0.19
6 years ago
1.0.18
6 years ago
1.0.17
6 years ago
1.0.16
6 years ago
1.0.15
6 years ago
1.0.14
6 years ago
1.0.13
6 years ago
1.0.12
6 years ago
1.0.11
6 years ago
1.0.10
6 years ago
1.0.9
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.4
6 years ago
1.0.0
8 years ago