//验证ip地址
private static var ip2:RegExp=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
public static function validIP(str:String):String
{
var s:String = "";
if (ip2.test(str))
{
}
else
{
s = "你输入的IP地址格式不正确";
}
return s;
}
//验证汉字
private static var chinese:RegExp =/^[\u4E00-\u9FA5]+$/;
public static function validChinese(str:String):String {
var r:String = "";
if(chinese.test(str)){
r = "你输入的字符串里面有汉字!";
}
return r;
}
flex 验证中文
最新推荐文章于 2013-10-14 15:44:12 发布