/ 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 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); }
URL: http://active.tutsplus.com/tutorials/actionscript/validating-various-input-data-in-flash/