Common metacharacters in Regular Expressions

Source: Internet
Author: User

Common metacharacters in Regular Expressions
/B matches the start or end of a word, for example,/BHI/B matches the word hi, but the word his fails to match.
. Match any character except line breaks
* The content on the front can be repeated for any time. Note: * The content must be included in the front.
. * When connected, it means any number of characters that do not contain line breaks.
/D match any number
The number of times that {2} matches the previous content. Note: The first character or Metacharacter
/S matches any blank characters, including spaces, tabs, line breaks, and Chinese fullwidth spaces.
/W matches letters, numbers, underscores, and Chinese characters.
/D + matches one or more consecutive numbers. Here, the "+" is similar to the "*" metacharacters. The difference is that * matches any number of times (which may be 0 times), while "+" matches the same number once or more times.
^ Match the start of a string
$ End of matching string
Note: The difference between ^ and $ and/B: the meaning of ^ and $ changes to the start and end of the matching row, for example, expression ^. * A $ matching s asa results in a matching failure. And/BA. * A/B matches S ASA successfully, and the result is ASA
^/W + match the first word in a row
Repeat:
* Repeated zero or more times
+ Repeat once or more times
? Zero or one repetition
{N} repeated n times
{N,} repeat n times or more times
{N, m} repeat n to m times
Negative:
/W match any character that is not a letter, number, underline, or Chinese Character
/S match any character that is not a blank character
/D: match any non-numeric characters.
/B matching is not the start or end of a word
[^ X] matches any character except x
[^ Aeiou] matches any character except aeiou.

Example:/S + matches strings that do not contain blank characters.

<A [^>] +> match a string prefixed with a enclosed in angle brackets.
| Equivalent to or

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.