Return to Snippet

Revision: 38511
at January 4, 2011 11:56 by Activetuts


Initial Code
public function checkWebAddress(address:String):Boolean
{
    var protocol:String     = "(https?:\/\/|ftp:\/\/)?";
    var domainName:String   = "([a-z0-9.-]{2,})";
    var domainExt:String    = "([a-z]{2,6})";
    var web:RegExp          = new RegExp('^' + protocol + '?' + domainName + "\." + domainExt + '$', "i");
 
    return web.test(address);
}

Initial URL
http://active.tutsplus.com/tutorials/actionscript/validating-various-input-data-in-flash/

Initial Description
From the tutorial, Validating Various Input Data in Flash (http://active.tutsplus.com/tutorials/actionscript/validating-various-input-data-in-flash/)

Initial Title
Validate a Web Address with RegExp

Initial Tags
url, regexp, validation, web

Initial Language
ActionScript 3