Metacharacters
^ $ . * + ? = ! : | / ( ) [ ] { }
When using these symbols, you need to use "" for the transfer.
If you don't remember that those punctuation marks need to be transferred, you can use the backslash "" when using punctuation marks.
Simple match
1. Direct quantity/javascript Tutorial/Match A string with "javascript" such as "JavaScript is an object-oriented scripting language"
2, []/[abc]/match the character "a" or "B" or "C"
3. [^]/[^abc]/matches any character except A, B, c
4,. /./any character
5, w/w/arbitrary ASCII single character, equivalent to [a-za-z0-9]
6, s/s/blank character
7, d/d/number, equivalent to [0-9]
Repeat
1, {n,m}/[a]{3,5}/repeat times at least n times the most m times, such as "AAA" or "AAAA" or "AAAAA"
2, {n,}/[a]{3,}/repeat times at least n times, such as "AAA" or "AAAAA" or "aaaaaa" ...
3, {n}/[a]/{3} just match n times, such as only match "AAA"
4,? /[a]?/0 times or 1 times
5, +/[a]+/1 or more times
6. */[a]*/0 or more times
Select, group
1, | /a|b/Select, Match "a" or "B"
2, ()/(ABC) +/groupings, matching "abc" or "Abcabc" www.111cn.net
Position
1. ^/^a/begins with "a", such as "AB" or "abc".
2, $/b$/to "B" end, such as "AB" or "CB" ...
Sign
1, i/a/i case-insensitive, such as "a" or "a"
2, g/b/g Global match, find all matches
Method
1. var ret = "JavaScript". Search (/script/i) returns the first occurrence of the substring starting character, no match returned-1
2. var ret = "JavaScript". Replace (/java/gi, "") to replace the matching substring with the second parameter of the function;
3. var ret = "JavaScript". Match ((Java) (script)/gi) returns an array
RET[0] Complete matching "javascript"
RET[1] The first bracket matches the substring "Java"
RET[2] The second bracket matches the substring "script"
......
4. var ret = "JavaScript". Split (/a/) returns an array with a substring of matching parameters as a delimiter decomposition string