The so-called regular expression, is to use a pattern to match a class of characters of a formula. The reaction to JS is a RegExp object.
It can also be said that the RegExp object represents a regular expression, which is a tool that performs pattern matching on a string.
There are two ways to create a RegExp object:
- Direct volume Syntax:/pattern/attributes
- Syntax created by the RegExp class's construction:new REGEXP (pattern, attributes)
Parameter pattern is a required parameter that specifies the pattern string that needs to be matched
The parameter attributes is an optional parameter that contains the attribute "G" "I" "M", respectively, for specifying global match, case-sensitive matching, and multiline matching.
To find characters in a range:
Metacharacters: Characters with special meanings
Quantifiers:
RegExp Object Properties:
RegExp object (Regular expression)