Mega Code Archive

 
Categories / JavaScript Tutorial / Regular Expressions
 

RegExp leftContext

The leftContext property represents the substring preceding the most recent pattern match. <html>     <body>     <script language="JavaScript">     <!--     pat = /is*/g;     var str = "This is a test";     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: " + RegExp.leftContext);     -->     </script>     </body>     </html>