1 | const HALF_CHARS = '\u0020-\u007F';
|
2 |
|
3 | const GEN_PUNCS = '\u2000-\u206f';
|
4 | const CJK_PUNCS = '\u3000-\u303f';
|
5 | const CJK_LETTERS = '\u4e00-\u9fbf';
|
6 | const FULL_CHARS = '\uff00-\uffef';
|
7 |
|
8 | const HALF_NUM = '0-9';
|
9 | const HALF_UPPER = 'A-Z';
|
10 | const HALF_LOWER = 'a-z';
|
11 | const FULL_NUM = '0-9';
|
12 |
|
13 | const FULL_UPPER = 'A-Z';
|
14 |
|
15 | const FULL_LOWER = 'a-z';
|
16 |
|
17 | const ANSI_ALPHA = /(?:(?:[a-zA-Z\d]*(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?)/;
|
18 | const ANSI_BETA = /(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-ntqry=><~])/;
|
19 | const ANSI = new RegExp(`[][[\\]()#;?]*(?:${ANSI_ALPHA.source}|${ANSI_BETA.source})`);
|
20 | const ASTRAL = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
21 |
|
22 | const HAN = new RegExp(`[${CJK_PUNCS}${CJK_LETTERS}${FULL_CHARS}]`);
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | const ANSI_G = new RegExp(ANSI, 'g');
|
35 | const ASTRAL_G = new RegExp(ASTRAL, 'g');
|
36 | const HAN_G = new RegExp(HAN, 'g');
|
37 |
|
38 | export { ANSI, ANSI_G, ASTRAL, ASTRAL_G, CJK_LETTERS, CJK_PUNCS, FULL_CHARS, FULL_LOWER, FULL_NUM, FULL_UPPER, GEN_PUNCS, HALF_CHARS, HALF_LOWER, HALF_NUM, HALF_UPPER, HAN, HAN_G };
|