JavaScript » RegExp » exec

Syntax:
object.exec([str])

This method executes a search for a match in a specified string, returning a result array.

object([str])
 
This method executes a search for a match in a specified string, returning a result array. (If, however, you simply want to test whether or not there is a match, it is best to use the test method or the String.search method.) For example, the following blocks of

NOTE:
 
The Netscape browser can call the exec method both directly (object.exec([str])) or indirectly (object([str])), whereas Microsoft Internet Explorer can only call it directly. If no string is declared then the value of RegExp.input is used. If the search fails, the exec method returns null.