Posted By

allnatural on 03/03/09


Tagged

url regexp validation regular validate experssion


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

mifly
thastyle
danhett
dubogii


URL Validation via RegExp


 / Published in: ActionScript 3
 

URL: http://www.flashcomguru.com/index.cfm/2009/2/17/regexp-validate-url

Founds this via http://www.flashcomguru.com/index.cfm/2009/2/17/regexp-validate-url

  1. var url:String = "http://www.google.com";
  2. var regex:RegExp = /^http(s)?:\/\/((\d+\.\d+\.\d+\.\d+)|(([\w-]+\.)+([a-z,A-Z][\w-]*)))(:[1-9][0-9]*)?(\/([\w-.\/:%+@&=]+[\w- .\/?:%+@&=]*)?)?(#(.*))?$/i;
  3. trace(regex.test(url)); // returns true if valid url is found

Report this snippet  

You need to login to post a comment.