The match() method is represented by the following syntax:
regexp - It represents the regular expression which is to be searched.
The matched regular expression.
Let's see some simple examples of match() method.
Let's see a simple example to search for a match.Test it Now
In this example, we will search for a regular expression using global flag.Test it Now
Let's see one more example to search for a regular expression using global flag. As match() method is case-sensitive, it return null in this case.Test it Now
We can ignore case-sensitive behaviour of match() method by using ignore flag. Let's understand with the help of example:Test it Now
Here, we will print the array of matched elements.Test it Now
Let's see the same example without using global search.Test it Now