Flex 4 ~ regular expression example

這範例是用簡單的正規表示法驗證身分證XD


var pattern:RegExp = /^([a-z]{1})([0-9]{9})/;
var str:String = humanID.text;
if(!pattern.test(str)){
Alert.show('身分證不符合格式');
return;
}


reference
http://livedocs.adobe.com/flex/3/html/help.html?content=12_Using_Regular_Expressions_11.html

沒有留言: