Re-compiles a regular expression with the new pattern and flags.
This method is deprecated. It’s not recommended to use it in new code.
compile(pattern, flags?)
pattern
A string that specifies the pattern of the regular expression.
flags optional
Flags.