/ 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 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/