1. JS Regular: With/start, with/end.
Test function: Go inside to find, as long as there is inside, return true; otherwise it will return false.
For example: rep=/\d+/; Check if there are any numbers inside.
2.rep=/^ $/; Start and end characters
rep=/^\d+$/; The representation begins with a number, ends with a number
3. EXEC: Default returns only the first compliant value. returns only 123.
4.
\w: any letter or number or underscore, any of the a_za_z0_9,_.
\b: matches a word boundary, that is, the position between a word and a space .
Str= "Wangli7 houfan8 wangyun2"
' wang\w+ ': begins with Wang and is followed by any character.
'/bwang\w+/b ': begins with Wang and ends with any character. The default can only match the first one. #wangli7
'/bwang (\w+) +/b ': Begins with Wang and ends with any character. After the parentheses are added, the contents of the back are also matched. grouping (equivalent to a level two match, and then one match in the first match). #wangli7 Li7
5. Match all eligible. (Global Match)
/g global match, match successful one take 1. When all is done, return a null.
6.
1. Define Regular expressions
- /.../for defining regular expressions
- /.../g represents a global match
- /.../i indicates case insensitive
- /.../m means that multiple lines matching JS regular match is in itself a multi-line support, where the multiline match only affects the regular expression ^ and the $,m pattern will also use ^$ to match the contents of the newline)
Form Validation 2-js Regular