[Transfer] Analysis of notepad++ using regular expressions to find Chinese characters in text

Notepad++ can perform regular expression search.

Occasionally, you need to find Chinese characters,

but I found that the

[\u4e00-\u9fa5]

[一-羥] circulating on the Internet

is not easy to use. Sometimes, some Chinese characters are not recognized by "long". However, after copying these texts, you can find them.

The research found that because txt files from Notepad or other places are generally saved in ansi format, they should be searched by single characters. Relatively, after copying and pasting, Notepad++ is unicode by default. Therefore,

[\u4e00-\u9fa5 ] and the like are encodings under unicode, so work well.

Similarly, save the above txt file as utf-8 format and reopen it with notepad, the above regular expression can work well.

Also, turn the basic regex rules for later use in

expression specification
\t tab.
\n new line .
. matches any character.
| matches characters to the left and right of the expression. For example, "ab|bc" Matches "ab" or "bc".
[] matches any single character in the list. For example, "[ab]" matches "a" or "b". "[0-9]" matches any number.
[^] Matches any single character outside the list. For example, "[^ab]" matches characters other than "a" and "b". "[^0-9]" matches any non-numeric character.

+ The character to its left is matched at least once (1, or more). For example, "be+" matches "be" or "bee" but not "b".
? The character to its left is matched 0 or 1 times. For example "be?" matches "b" or "be" but not "bee".
The expression to the right of ^ is matched at the beginning of a line. For example "^A" matches only lines starting with "A".
$ its The expression on the left is matched at the end of a line. For example "e$" matches only lines ending with "e".
() affects the order in which expressions are matched and is used as a grouping marker for expressions.
\ Escape character. If you want to use "\" itself, you should use "\\".

http://blog.csdn.net/darkread/article/details/8485790

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326115790&siteId=291194637
Recommended