javascript regular expression exec( )
exec( ) | Firefox/Netscape/NN 4 IE 4 ECMA 3 |
exec(string) | |
Performs a search through the string passed as a parameter for the current regular expression pattern. A typical sequence follows the format: var myRE = /somePattern/; var resultArray = myRE.exec("someString"); |
|
Properties of both the static RegExp and regular expression instance (myRE in the example) objects are updated with information about the results of the search. In addition, the exec( ) method returns an array of data, much of it similar to RegExp object properties. The returned array includes the following properties:
|
|
You can stow away the results of the exec( ) method in a variable, whereas the RegExp property values change with the next regular expression operation. If the regular expression is set for global searching, a subsequent call to myRE.exec("someString") continues the search from the position of the previous match. |
|
If no match is found for a given call to exec( ), it returns null. |
|
Parameters | |
|
|
Returned Value | |
An array of match information if successful; null if there is no match. |
Powered by Linode.