RegExp.leftContext

JavaScript 1.2+, JScript 3.0+ Nav4+, NES3+, IE4+ Syntax

							regexp.leftContext

Description

The leftContext property of the RegExp object represents the substring preceding the most recent pattern match.

Example

Listing 6.222 shows how the leftContext property is used.

Listing 6.222 Example of the leftContext Property
 <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>" + "I know where the fish is tonight" + "</b><br><br>"); document.write("The RegExp.leftContext is: " + ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.