August 1999
Intermediate to advanced
1488 pages
72h 53m
English
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.
In Listing 6.215, you see how the exec() method is used. A regular expression is defined and executed on the string using the exec method.
<html> <body> <script language="JavaScript"> <!–– Hide // checks for the pattern "xyz" in str. If found, then // output written to document indicating that it was found and // displays the index it was found in the string. myRe=/xyz*/g; ... |
Read now
Unlock full access