Question - What are the methods of a regular expression?
Answer -
There are 3 different methods for regular expressions are listed below.
- exec() : scans for a matching string and returns the first matched string
- test() : scans for a matching string and returns boolean value false or true.
- toString() : This method returns the string value of a regular expression.