Skip to content

Commit efb65ca

Browse files
committed
docs(regex): 正则匹配 Emoji 字符
1 parent 5e7e24e commit efb65ca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/regex.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,17 @@ regex.test('ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ') // true
464464
// 匹配所有空格
465465
\p{White_Space}
466466

467+
// 匹配十六进制字符
468+
\p{Hex_Digit}
469+
467470
// 匹配各种文字的所有字母,等同于 Unicode 版的 \w
468471
[\p{Alphabetic}\p{Mark}\p{Decimal_Number}\p{Connector_Punctuation}\p{Join_Control}]
469472

470473
// 匹配各种文字的所有非字母的字符,等同于 Unicode 版的 \W
471474
[^\p{Alphabetic}\p{Mark}\p{Decimal_Number}\p{Connector_Punctuation}\p{Join_Control}]
472475

473476
// 匹配 Emoji
474-
/\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu
477+
/\p{Extended_Pictographic}/u
475478

476479
// 匹配所有的箭头字符
477480
const regexArrows = /^\p{Block=Arrows}+$/u;

0 commit comments

Comments
 (0)