Chapter 12 Example 1

by actionscriptbible
♥0 | Line 12 | Modified 2009-07-23 05:33:31 | MIT License
play

ActionScript3 source code

/**
 * Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/k1Yb
 */

package {
  import com.actionscriptbible.Example;
  public class ch12ex1 extends Example {
    public function ch12ex1() {
      trace("---- Testing");
      var phoneNumberPattern:RegExp = /\d\d\d-\d\d\d-\d\d\d\d/;
      trace(phoneNumberPattern.test("347-555-5555")); //true
      trace(phoneNumberPattern.test("Call 800-123-4567 now!")); //true
      trace(phoneNumberPattern.test("Call now!")); //false 
    }
  }
}