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; } } }