Notes on mastering Regular Expressions

Source: Internet
Author: User

Lazy ~~

Tool: RegexBuddy

Regex origin: Abbreviation of regular expression

[-./]: This is often seen before. Because I have never learned regular expressions, I have always misunderstood '-'. In fact, the first occurrence of this character in [] represents a common character, with no other meaning. The last '/' is also true.

| And (): '|' is an interesting thing. It works with group symbols just like magic, and can easily write simple regular expressions. The latter is said to limit the former.

? + * {Min, max}: Let's see what it means, if you have learned a computer.

^: I thought about it when I tried to write it. I hate you ~

Flavor: genre, irrelevant to regular expressions. Learn English.

Budding regexers: Clever regular expressions.

$1, 2, 3... : The storage rule is to view the order in which the first parentheses appear in the group. If you do not want to store the rules, you can use (? :).

(? =) And (? <=): Lookahead indicates loop. The former is displayed on the right, and the latter is displayed on the left, which does not occupy characters because it only represents the position.

(?!) And (? <!) : Reversed from the above.

The author of this book has k or perl in his mind. I don't care whether it is good or not.

The origins of Regular Expressions: actually originated from two neuroscientists, and nature is amazing ~

The \: \ w \ t and so on in the string should be careful, \ stands \

Unicode: C # supported, haha

Simple character group subtraction: [[a-z]-[aeiou]

Group Declaration: by default, the group is declared by left parentheses (in the order of appearance, you can also name the <name> example :(? <Name> )(? 'Name ')

\ W, \ d, \ s: to process all the appropriate Unicode characters, you can enable RegexOptions. ECMAScript to limit

RegexOptions. ExplicitCapture: ungroup

Reverse group: \ k <name> or \ k'name'

In the relpacement string: $ {name}

(? <DEPTH> )\(? <-DEPTH>): indicates the DEPTH. If the preceding image appears, it is XXXX. The former is + 1 and the latter is-1.

(? (DEPTH): determines whether it meets the DEPTH

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.