Skip to content

Commit

Permalink
docs(regex): 正则匹配 Emoji 字符
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanyf committed May 15, 2024
1 parent 5e7e24e commit efb65ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/regex.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,14 +464,17 @@ regex.test('ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ') // true
// 匹配所有空格
\p{White_Space}

// 匹配十六进制字符
\p{Hex_Digit}

// 匹配各种文字的所有字母,等同于 Unicode 版的 \w
[\p{Alphabetic}\p{Mark}\p{Decimal_Number}\p{Connector_Punctuation}\p{Join_Control}]

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

// 匹配 Emoji
/\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu
/\p{Extended_Pictographic}/u

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

0 comments on commit efb65ca

Please sign in to comment.