您可以使用Ray Camden的UDF from cflib.org。它對我很好用
<cfscript>
/**
* Searches a string for email addresses.
* Based on the idea by Gerardo Rojas and the isEmail UDF by Jeff Guillaume.
* New TLDs
* v3 fix by Jorge Asch
*
* @param str String to search. (Required)
* @return Returns a list.
* @author Raymond Camden
* @version 3, June 13, 2011
*/
function getEmails(str) {
var email = "(['_a-z0-9-]+(\.['_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\. ((aero|coop|info|museum|name|jobs|travel)|([a-z]{2,3})))";
var res = "";
var marker = 1;
var matches = "";
matches = reFindNoCase(email,str,marker,marker);
while(matches.len[1] gt 0) {
res = listAppend(res,mid(str,matches.pos[1],matches.len[1]));
marker = matches.pos[1] + matches.len[1];
matches = reFindNoCase(email,str,marker,marker);
}
return res;
}
</cfscript>
使用'REMatchNoCase()'和良好的電子郵件正則表達式 – Henry