recommended

  • Regex Golf

    • ps:Through parsing
  • Online parsing regularization – Regex101

  • A 30-minute introduction to regular expressions

specification

  • Prioritize lazy mode? Ps: Regular expressions have a higher priority than the lazy/greedy rule: matches that start first have the highest priority. Such as a. +? C -> ababc will match the entire string ababc.

  • Give preference to non-capture groups (? 🙂

learning

  1. The number qualifier after a character is used to limit the number of occurrences of the preceding character (notagainNumber of occurrences), an unrestricted number means once and only once.
  2. After to the referenceUsed to repeatedly search for text that matches a previous group,\numIs for repeated content;+.*.{num}Such repeated matching simply repeats the syntax.

grammar

  • Sign priority

    priority symbol
    The highest \
    high (a),(? :),(? =),[]
    In the *,+,?,{n},{n,},{n,m}
    low ^,$,Intermediary character
    Times the minimum concatenatedThat is, adjacent characters are joined together
    The minimum `
  • Shorthand character set

    character instructions
    \s Matches any whitespace character, including Spaces, tabs, feed characters, and so on. Is equivalent to[ \f\n\r\t\v]
    \S Matches any non-whitespace character. Is equivalent to[^ \f\n\r\t\v]
    \d Matches a numeric character
    \D Matches a non-numeric character
    \w Matches any word character that includes an underscore. Is equivalent to[A-Za-z0-9_]
    \W Matches any non-word character. Is equivalent to[^A-Za-z0-9_]
    \b Matches a word boundary, that is, the position between a word and a space
    \B Matches non-word boundaries
  • Zero width assertion

    character instructions
    (? =exp) The position where the assertion itself appears matches the expression exp. Matches the position in front of exp
    (? <=exp) The position before which the assertion itself appears matches the expression exp. Matches the position after exp
    (? ! exp) Assert that the expression exp cannot be matched after this position. The match is not followed by the position of exp
    (? <! exp) Assert that this position does not precede the expression exp. Matches positions that are not preceded by exp