JavaScript - regular expression metacharacters

<! DOCTYPE HTML> 
<HTML> 
<head> 
<Meta charset = "UTF-. 8"> 
<Meta HTTP-equiv = "X--the UA-Compatible" Content = "IEs = Edge, Chrome =. 1"> 
<title> Regular expressions </ title> 
<Script> 
	/ ** 
	 * regular expression: also called regular expressions, an expression, this effect according to certain rules composed mainly of expression matching string 
	 * 
	 * regular expressions role: to match the string 
	 * can be used in most programming languages 
	 * 
	 * regular expression: the oil or meta-character qualifier is a formula consisting of 
	 * 
	 * metacharacters: 
	 * (1) except \. n is any character other than '1' 
	 * (2) [] 1, range, any number between [0-9] 0-9 | [az] between any of a lowercase letter az | [AZ] AZ any of a capital letter between | between any of [a-zA-Z] az AZ a letter | [0-9a-zA-Z] any of a number or letter 
	 * 2, the significance of the regular expression characters Ghost get rid of representation is a [.]. 
	 * (3) | or [0-9] | [az] is either a number or a lowercase letter
	 * (4) () a packet priority as lifting, [0-9] | ([az ]) | [AZ] Priority calculation inside the parentheses, such as lower case letters, ([0-9]) ([ az]) ( [AZ]) three groups counted from the leftmost such as (() (())) four groups (() (( 
	 * 
	 * the following both of these meta-characters can also be called qualifiers: 
	 * (5) * indicates that: the preceding expression appears 0 times to several [az] [0-9] * will be a lowercase letter and any number will appear 0 times to 
	 * 'svnazsjb230203023' [az] [0-9] * to true 
	 * (6) when the front + means expressing one or more times 
	 * [az] [9] + behind a minimum of one lowercase letter 9, or a plurality of 9 "jafmv9vadv"        
	 * (. 7)? it is represented by the foregoing expression It appeared 0 times to 1 times, minimum 0, maximum of 1, another meaning: to stop greedy [4] [az] "142324ij"? 
	 * 
	 * qualifier: limit the number of times the preceding expression appears 
	 * 
	 * (8 )} {the number of times may be more clearly appears in front of the expression 
	 * (1 {0,1} indicates that the expression appeared to multiple times 0 (*) 
	 * (2, {1} represents the foregoing expression appears 1 to a multiple (+) 
	 * (3, {0,1} indicates that expression appears 0 times to 1 times (?) 
	 * (4, {3,4} denotes the previous table Expression appeared three times to four times
	 * (5, {4} indicates that the expression appears four times 
	 * (6, {30} error 
	 * (9) is represented by what began ^ (^ [0-9] with a digit; ^ [ az] with a lowercase letter), or is negated (inverted) ([^ 0-9] non-numeric; [^ 0-9a-zA-Z )] takes a special symbol (not the special symbol underscore _) 
	 * (10 ) $ express what end [0-9] [az] $ must end with a lowercase letter (1a); ^ [0-9] [az] $ strict mode is equivalent to write "1234re" falus // "4f" to true 
	 \ any * (11) d numbers in a 
	 * (12) \ any D non-numeric one (letters + special symbols) 
	 * (13) \ any s whitespace one 
	 * (14) \ s whitespace any one of a 
	 * (15) \ w non-special characters (_) is equivalent to [0-9a-zA-Z_] 
	 * (16) \ W is equivalent to special symbols ^ [0-9a-zA-Z_] 
	 * (17) \ b word boundary 
	 * (18) \ f feed character 
	 * (19) \ n newline 
	 * 
	 * 
	 * 
	 * 
	 * 
	 * 
	 * / 
	/ * string element #### used 

        | metacharacters | instructions |
        | ---- | --------------- | 
        | \ d | matching digits | 
        | \ D | matches any non-numeric characters | 
        | \ w | match letters or numbers or an underscore | 
        | \ W is | not match any of letters, numbers, underscores | 
        | \ S | match any whitespace | 
        | \ S | not match any whitespace characters | 
        |. | match any single character except newline | 
        | ^ | which matches the first line of text (to who started) | 
        | $ | representing the text matched end of the line (to who end) | 
        
        #### yuan commonly used strings 
        
        | metacharacters | Description | 
        | ---- | - ----------------------------- | 
        | \ d | matching digits | 
        | \ d | matches any non-numeric characters |
        | \ W | matching letters or numbers or underscores | 
        | \ W is | match any instead of letters, numbers, underscores | 
        | \ S | match any whitespace | 
        | \ S | match any not whitespace characters | 
        |. | Match any single character except newline | 
        | ^ | which matches the first line of text (to who started) | 
        | $ | representing the text matched end of the line (to who end) | 
        
        #### qualifier 
        
        | qualifier | Description | 
        | ----- | ----------------- | 
        | * | repeated zero or more times | 
        | + | repeated one or more times | 
        |? | repeat ZeroOrOne | 
        |} n {| n times | 
        | {n,} | repeated n times or more | 
        | {n, m} | repeated n times to m | 

       #### other 

       [] characters string enclosed in square brackets, any of which represents a character matching, or equivalent means
       [^] Matches the contents within the brackets in addition to 
       \ escape 
       | a or both, selection. Note that | divided into two parts left and right sides, regardless of how long the left and right sides of the multi disorder 
       () directly to the amount of two selected from a grouping 
          eg: gr (a | e) y and matching gray Gray 
       [\ u4e00- \ u9fa5 ] Chinese characters matching 
       
        * / 
</ Script> 
</ head> 
<body> 
    
</ body> 
</ HTML>

  

Guess you like

Origin www.cnblogs.com/sylys/p/11600118.html