/ Published in: ActionScript 3
From the tutorial, Validating Various Input Data in Flash (http://active.tutsplus.com/tutorials/actionscript/validating-various-input-data-in-flash/)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public function checkPhoneNumber(phoneNumber:String):Boolean { var countryCode:String = "((\\+|00)?([1-9]|[1-9][0-9]|[1-9][0-9]{2}))"; var num:String = "([0-9]{3,10})"; phoneNumber = phoneNumber.match(/[\+\d]/g).join(''); var phone:RegExp = new RegExp("^" + countryCode + num +"$"); return phone.test(phoneNumber); }
URL: http://active.tutsplus.com/tutorials/actionscript/validating-various-input-data-in-flash/