Syntax
regexp.exec(string)
The exec() method of the RegExp object executes the search for a match in a specified string.
The results are returned in an array.
The string passed contains the string the regular expression is trying to match in.
<html> <body> <script language="JavaScript"> <!-- myRe=/xyz*/g; str = "abcxyzdefhij" myArray = myRe.exec(str); document.writeln("Found " + myArray[0] + " in the pattern: " + "<b>" + "abcxyzdefhij " + "</b>" + " at index " + (myRe.lastIndex - 3)); --> </script> </body> </html>