The syntax of using this constructor has been defined as follows:-
new RegExp(regExp , flags)
Here regExp is the expression to be cloned and flags determine the flags of the clone. There are mainly three types of flags that are used.
- g:global flag with this flag the search looks for global match.
- i: With this flag the search is case-insensitive.
- m: With this flag we perform multi line matching.