1. Explicitly create regular expressions: var searchpattern=new RegExp (' +s '); The plus sign matches any one of the strings with one or more contiguous s.
2. Methods forRegExp objects:test and exec
- The test method determines whether the string passed in as a parameter matches the regular expression, and the return value is type bool.
- The Exec return value is an array that matches the matching criteria.
3. The regular expression character used to match a particular occurrence of the character has four: the asterisk (*) matches the character in front of it 0 or more times, plus (+) matches the character in front of him one or more times, and say hello (?). Matches the character that precedes it 0 or 1 times. The dot (.) matches one character.
4.\d This sequence is a pattern for finding any non-numeric character ;\s is a blank character ;\d matches only numbers .
5. Use square brackets with a numeric range, preceded by an up arrow (^). If you want to match any non-numeric character, use the following pattern: [^0-9], equivalent to \d; the matching number is removed by the upper arrow ^,[0-9] equivalent to \d. If you want to match more than one character, you can list the range of each character in the middle of the square brackets [a-za-z]. Above the Upper arrow if the square brackets outside the match any one line starts , the $ symbol matches any one line to the end. If a multiline flag mis used, the UP arrow matches the first character after the line break. The above content shows that any match is. *.
6.the \w sequence matches any one letter and number , including underscores . \w is equivalent to any non-word character.
7,| The vertical bar indicates or means that the curly braces indicate the number of repetitions of the preceding character.
javascript--Regular Expressions