var str:String = "[email protected]";
var pattern:RegExp = /\w+([-+].\w+)*@\w+([-.]\w)*\.\w+([-.]\w)*/;
或者
var pattern = new RegExp("\\w+([-+].\\w+)*@\\w+([-.]\\w)*\\.\\w+([-.]\\w)*");
trace(pattern.test(str));
时间: 2024-10-07 22:03:41
var str:String = "[email protected]";
var pattern:RegExp = /\w+([-+].\w+)*@\w+([-.]\w)*\.\w+([-.]\w)*/;
或者
var pattern = new RegExp("\\w+([-+].\\w+)*@\\w+([-.]\\w)*\\.\\w+([-.]\\w)*");
trace(pattern.test(str));