Match Unicode characters
Sometimes we need to match characters outside of the ASCII range.
"Qu ' est-ce que la tolérance?" C ' est l ' apanage de l ' Humanité. Nous sommes tous pétris de faiblesses et d ' erreurs; Pardonnons-nous réciproquement nos sottises, c ' est la première loi de la nature. "-voltaire (1694–1778) what is Toleran Ce? It is the consequence of humanity. We are all formed of frailty and error;let us pardon reciprocally each other's folly--that is the first law of nature.
We'll enter the quotes of Voltaire into http://www.regexpal.com/and enter regular expressions.
\u00e9
\u followed by the hexadecimal value 00e9, here is not case-sensitive, 00E9 can also, 00E9 docking decimal value 233, outside of ASCII (0~127).
Note that in Regexpal, the letter E, which is the lower case, is marked with a grave accent, because é is u+00e9 in Unicode, so \u00e9 can match it.
Regexpal.com is a regular expression implementation of JavaScript. JavaScript also allows the following syntax to be implemented:
\xe9
Now let's try it out in the other regular engines. Http://regexhero.net/tester/is written in. Net.
Ancient Pond Frog Fly accolades komagome 飲む water tone -Banana (1644–1694) at the ancient Ponda frog plunges intothe Sound ofwater. -basho (1644–1694)
These are the haiku of the Japanese poet Pine-tailed banana.
Enter it into Regexhero, and then enter the regular
\u6c60
This is the code point for the Japanese character that corresponds to the word pond pond.
Alternatively, you can match the long dash
\u2014
or short dash
\u2013
Match characters with octal numbers
In regular, the octal number is the backslash followed by a three-digit number.
Like what
\351
Equivalent to
\u00e9
Match control characters
The code base's ASCII.txt is all ASCII characters, one character line, and 128 lines.
In a regular expression, you specify a control character like this:
\cx
where x is the control character you want to match.
Match Unicode and other characters
Getting Started with regular expressions (vi) matching Unicode and other characters