Return simply whether the string matches the pattern at all. : Match : Regular Expressions Flash / Flex / ActionScript examples


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

 

Return simply whether the string matches the pattern at all.


 

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

        var phoneNumberPattern:RegExp = /ddd-ddd-dddd/;
        trace(phoneNumberPattern.test("347-222-2225"))//true
        trace(phoneNumberPattern.test("Call 800-123-4567 now!"))//true
        trace(phoneNumberPattern.test("Call now!"))//false

    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Regular Expressions
» Match