Parameters: This method accepts single parameter regexp which is required. It is used to pass the value to search for as a regular expression.
Regular expression (regexp): It is a particular syntax /pattern/modifiers; modifier sets the type. For example /GeeksforGeeks/i where “i” sets to case insensitive.
Note: Here g and i used for global and case-insensitive search respectively.
Example 1: This example describes the search of a regular expression.
- Before clicking on the button:
- After clicking on the button:
Example 2: This example describes the search of a regular expression.
- Before clicking on button
- After clicking on button: