/[0-9]/
/\d/
two。 Match multiple digits
/[0-9]+/
/\d+/
/[0-9]{1,3}/
/\d{1,3}/
1.\ s Match white space characters, including spaces, line breaks, tab indentation, etc. 2.\ s Matches non-white space characters, as opposed to\ s
/[\s\S]*/
/[\w\W]*/
+
The leading character must appear one or n times in the target string/\d+/
*
The leading character must appear 0 times or consecutive n times in the target string/\d*/
/\d?/
^
Locate the first 1 character of the string/^\d/
$
/\d$/
Locate the last 1 character of the string
/\([\w\W]*\)/.exec("(add (mul 1 2) 3)")
Results: (add (mul 1 2) 3)
two。 Non-greedy mode
Add it before \)
? Number means that if you encounter the first one, it will be over.
/\([\w\W]*?\)/.exec("(add (mul 1 2) 3)")
Result: (add (mul 1 2)