From 2f6e4e4d1d56838da3b6babf912a0b33e3909b1e Mon Sep 17 00:00:00 2001 From: fechin Date: Fri, 18 Nov 2022 15:50:49 +0800 Subject: [PATCH] =?UTF-8?q?Added=20Unicode=20H=C3=A0n=20expression=20to=20?= =?UTF-8?q?regex.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/_posts/regex.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/_posts/regex.md b/source/_posts/regex.md index 6c77a87..7a7c17e 100644 --- a/source/_posts/regex.md +++ b/source/_posts/regex.md @@ -338,13 +338,14 @@ Use `\` to search for these special characters:
`[ \ ^ $ . | ? * + ( ) { }` Order longer to shorter when alternatives overlap ### Character classes -| Pattern | Matches | -|---------------|--------------------------------------------------------------------| -| `[aeiou]` | Match any vowel | -| `[^aeiou]` | Match a NON vowel | -| `r[iau]ng` | Match ring, wrangle, sprung, etc. | -| `gr[ae]y` | Match gray or grey | -| `[a-zA-Z0-9]` | Match any letter or digit | +| Pattern | Matches | +|-------------------|--------------------------------------------------------------------| +| `[aeiou]` | Match any vowel | +| `[^aeiou]` | Match a NON vowel | +| `r[iau]ng` | Match ring, wrangle, sprung, etc. | +| `gr[ae]y` | Match gray or grey | +| `[a-zA-Z0-9]` | Match any letter or digit | +| `[\u3a00-\ufa99]` | Match any [Unicode Hàn (中文)](https://unicode.org/charts/unihan.html) | In `[ ]` always escape `. \ ]` and sometimes `^ - .`