JavaScript | Regular Expressions JSON | Question 5

Last Updated :
Discuss
Comments

What is the purpose of the exec() method in RegExp?

Searches a string for a pattern and returns its index

Returns a boolean indicating if a match is found

Splits a string into an array based on a pattern

Returns an array of match details or null if no match is found

Share your thoughts in the comments