flex 验证邮件正则表达式 匹配多个收件人
2010-09-02 14:25
330 查看
package eserver.dbaudit.renderers.validators
{
import com.captech.utils.GetText;
import eserver.common.utils.StringUtil;
import mx.validators.StringValidator;
import mx.validators.ValidationResult;
public class MutiEmailValidator extends StringValidator
{
private var results:Array;
public function MutiEmailValidator()
{
super();
}
override protected function doValidation(value:Object):Array {
var txt:String = value as String;
results = [];
results = super.doValidation(value);
if (results.length > 0) {
return results;
}
txt = txt.replace(',', ';');
var tempArry:Array = StringUtil.toArray(txt, ';');
var len:int = tempArry.length;
// var reg:RegExp = /(/w+((-/w+)|(/./w+))*)/+/w+((-/w+)|(/./w+))*/@[A-Za-z0-9]+((/.|-)[A-Za-z0-9]+)*/.[A-Za-z0-9]+/;
// var reg:RegExp = /([a-z0-9A-Z]+[-|/.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?/.)+[a-zA-Z]{2,}/;
var reg:RegExp = /^([a-z0-9A-Z]+[_/.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?/.)+[a-zA-Z]{2,}$/;
while (len--) {
if (!reg.test(tempArry[len])) {
results.push(new ValidationResult(true,
"text",
"StringTooLong",
GetText._('[{0}] does not match the format',
tempArry[len])));
}
}
return results;
}
}
}
{
import com.captech.utils.GetText;
import eserver.common.utils.StringUtil;
import mx.validators.StringValidator;
import mx.validators.ValidationResult;
public class MutiEmailValidator extends StringValidator
{
private var results:Array;
public function MutiEmailValidator()
{
super();
}
override protected function doValidation(value:Object):Array {
var txt:String = value as String;
results = [];
results = super.doValidation(value);
if (results.length > 0) {
return results;
}
txt = txt.replace(',', ';');
var tempArry:Array = StringUtil.toArray(txt, ';');
var len:int = tempArry.length;
// var reg:RegExp = /(/w+((-/w+)|(/./w+))*)/+/w+((-/w+)|(/./w+))*/@[A-Za-z0-9]+((/.|-)[A-Za-z0-9]+)*/.[A-Za-z0-9]+/;
// var reg:RegExp = /([a-z0-9A-Z]+[-|/.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?/.)+[a-zA-Z]{2,}/;
var reg:RegExp = /^([a-z0-9A-Z]+[_/.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?/.)+[a-zA-Z]{2,}$/;
while (len--) {
if (!reg.test(tempArry[len])) {
results.push(new ValidationResult(true,
"text",
"StringTooLong",
GetText._('[{0}] does not match the format',
tempArry[len])));
}
}
return results;
}
}
}
相关文章推荐
- 正则表达式 -- 邮件地址验证解析
- php正则表达式验证(邮件地址、Url地址、电话号码、邮政编码)
- 验证邮件地址的正则表达式
- C#验证邮件的正则表达式的代码
- 验证数字,日期,邮件地址的正则表达式
- 史上最复杂的验证邮件地址的正则表达式
- JS正则表达式匹配检测各种数值类型(数字验证)
- 使用Java正则表达式验证邮件地址
- js正则表达式验证邮件地址
- C# Regex.IsMatch (正则表达式验证:数字、小数点、邮件、计算表达式)
- php中使用正则表达式验证邮件地址
- C#验证邮件的正则表达式的代码
- Flex 正则表达式 电话、邮箱验证
- 史上最复杂的验证邮件地址的正则表达式
- 使用正则表达式匹配模式(验证电子邮件地址)
- js : 正则表达式 -- 邮件地址验证解析
- jQuery验证,匹配输入非中文的正则表达式,输入内容可以是包括空格等特殊字符的任何字符。
- php中正则表达式的匹配和数据验证总结
- Flex的正则表达式匹配速度与手工代码的比较
- JS正则表达式匹配检测各种数值类型(数字验证)