August 1999
Intermediate to advanced
1488 pages
72h 53m
English
RegExp.$`
The RegExp.$` property represents the substring preceding the most recent pattern match. This is the same as using the leftContext property.
Listing 6.210 shows how to use RegExp.$`
<html> <body> <script language="JavaScript"> <!–– Hide // define a regular expression pattern and match globally pat = /is*/g; // create a string object var str = "I know where the fish is tonight."; // create an array to hold the results myArray = pat.exec(str); document.write("In the string: " + "<b>"); document.write("I know where the fish is tonight" + "</b><br><br>"); document.write("The RegExp.leftContext is: " + RegExp.leftContext); ... |
Read now
Unlock full access