/ Published in: ActionScript 3
Today, almost everything on the web is based on user input. A contact form, a user registration form, a search box and so on. As a developer you can’t just rely on the user to write everything as it’s supposed to be. To be sure you always get the correct data from your users you will need to validate the input. (By Enabled)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public function checkDate(date:String):Boolean { var month:String = "(0?[1-9]|1[012])"; var day:String = "(0?[1-9]|[12][0-9]|3[01])"; var year:String = "([1-9][0-9]{3})"; var separator:String = "([.\/ -]{1})"; var usDate:RegExp = new RegExp("^" + month + separator + day + "\\2" + year + "$"); var ukDate:RegExp = new RegExp("^" + day + separator + month + "\\2" + year + "$"); return (usDate.test(date) || ukDate.test(date) ? true:false); }
URL: http://active.tutsplus.com/tutorials/actionscript/validating-various-input-data-in-flash/