-
-
Save ivanionut/e2facaeefa3b603a76e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name="sanitizeEmailList" access="public" returnType="String" output="false"> | |
<cfargument name="emailList" type="String" required="true" /> | |
<cfset var local = {} /> | |
<cfset local.email = '' /> | |
<cfset local.RegEx = "[a-z0-9!##$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!##$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"/> | |
<cfloop list="#arguments.emailList#" index="local.i"> | |
<cfset local.address = ReMatch(local.RegEx,local.i)/> | |
<cfif ArrayLen(local.address)> | |
<cfset local.email = ListAppend(local.email,local.address[1]) /> | |
</cfif> | |
</cfloop> | |
<cfreturn local.email /> | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment