Getting Started with regular expressions (vi) matching Unicode and other characters

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.