read and write to this property to move the starting point of the next match : LastIndex : Regular Expressions Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Regular Expressions » LastIndex »

 

read and write to this property to move the starting point of the next match


 


package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var reCase:RegExp = new RegExp("abc""ig");
        var sVal:String = "aBcdefabCdefABC";
        var aMatch:Array = reCase.exec(sVal);
        trace(aMatch + " - " + reCase.lastIndex);
        aMatch = reCase.exec(sVal);
        trace(aMatch + " - " + reCase.lastIndex);
        aMatch = reCase.exec(sVal);
        trace(aMatch + " - " + reCase.lastIndex);
        aMatch = reCase.exec(sVal);
        trace(aMatch + " - " + reCase.lastIndex);
        aMatch = reCase.exec(sVal);
        trace(aMatch + " - " + reCase.lastIndex);

    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Regular Expressions
» LastIndex