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 = /\d\d\d-\d\d\d-\d\d\d\d/; trace(phoneNumberPattern.test("347-222-2225")); //true trace(phoneNumberPattern.test("Call 800-123-4567 now!")); //true trace(phoneNumberPattern.test("Call now!")); //false } } }