RegExp.$& (2) : RegExp Object : Regular Expressions JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Regular Expressions » RegExp Object »

 

RegExp.$& (2)








The RegExp.$& property represents the last matched characters.

This is the same as using the lastMatch property.












<html>
    <body>
    <script language="JavaScript">
    <!--

    var pat = new RegExp("test""gi");
    str = "This is a test 123435";
    myArray = pat.exec(str);

    document.write("Pattern found: " + myArray[0". the last match expression is: " + RegExp.lastMatch);

    -->
    </script>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Regular Expressions
» RegExp Object