Regular personal summary

Shorthand comprehension skills

.

[ ]

^

$

Four characters are all languages ​​support regular expressions, so this is the basis of four regular expressions. Regular difficult to understand because it has an equivalent concept, the concept has greatly increased the difficulty of understanding, so many beginners look ignorant, if the equivalent are restored to the original wording of his own writing on a regular super simple, like talk Like to write your regular up:


  Is equivalent to:

Is equivalent to the equivalent meaning, it represents the same function with different symbols to write.

?, *, +, \ d , \ w are equivalent character
  ? match length equivalent to {0,1}
  * {0 equivalent to the match length}
  + equivalent length of the matched. 1 {,}
  \ D, etc. is equivalent to [0-9]

\ D is equivalent to [^ 0-9]
  \ W is equivalent to [A-Za-z_0-9]

\ W, etc. 价于 [^ A-Za-z_0-9].

Common operator of the expression: ^ Start   () domain paragraph [] comprising, a default character length [^] is not included, a default character length { n- , m } matches the length of any single character (\ character points.). | or \ to escape $ end [AZ] 26 uppercase letters [az] 26 lowercase letters [0-9] 0-9 digital
  

  
  
  
  
  
  
  
  
  
  

[A-Za-z0-9] 26 uppercase letters, lowercase letters 26 and numbers 0-9
  , segmentation
   .
  
  Segmentation Syntax:
   [A, H, T, W] comprises H or A or T or letter W
  [a, h, t, w] comprising a or t or w h letters or
  [0,3,6,8] comprises 0 or 3 or 6 or 8 figures


  Grammar Interpretation: basic grammar "^ ([] {}) ([] {}) ([] {}) $"   regular string = "Start ([containing content] {length}) ([containing content] {length }) ([containing content]} {length) end " , *, +, \ D, \ W which are short, and can use [] and {} instead of (:???) (=) ( ?!) (? <=) (? <!) (? i) (*?) (+?) except for this particular combinations.   Beginners can ignore ?, *, +, \ D , \ w some of shorthand identifier, learned the basics then use the table to go their own equivalent replacement
  

  
  

Guess you like

Origin www.cnblogs.com/lal520/p/11289136.html