Extracting phone number : Phone Number : Regular Expressions Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Regular Expressions » Phone Number »

 

Extracting phone number


 

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

        var contactNumbers:String =
            "Los Angeles: 310-222-2225n" +
            "New York: 212-222-2499n" +
            "Boston: 617-222-2222";
        var nyPhone:RegExp = /New York: (d{3}-d{3}-d{4})/;
        var matches:Array = contactNumbers.match(nyPhone);
        trace(matches[1])//212-222-2499

    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Regular Expressions
» Phone Number