RegExp.lastIndex : RegExp Object : Regular Expressions JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Regular Expressions » RegExp Object »

 

RegExp.lastIndex







The lastIndex property gets the index of where the next match begins.












<html>
    <body>
    <script language="JavaScript">
    <!--
    exp=/is*/g;
    str = "This is just a sample sentence.";
    myArray = exp.exec(str);
    document.write("Found: " + myArray[0+". Next match starts at index: " + exp.lastIndex);
    -->
    </script>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Regular Expressions
» RegExp Object