Modifs emalis 1601241352

This commit is contained in:
Laurie MONTANT 2024-01-16 13:52:38 +01:00
parent 12e29c6644
commit c7fbfe21fb

View File

@ -10,17 +10,18 @@
<#-- Split email reflex into json array string -->
<#-- Example : splitemail "john.doe@hardis-group.com,; name@hardis-group.com" -->
<#-- return "["john.doe@hardis-group.com","name@hardis-group.com"]" -->
<#-- ${splitEmailsIntoArray(emailReflex)} -->
<#-- --------------------------------------------------------------------------------------- -->
<#function splitEmailsIntoArray emails >
<#local str = "[">
<#list emails?split(';|,| ',"r")?filter(l -> l != "") as email>
<#list emails?split(";|,| |à|/","r")?filter(l -> l != "") as email>
<#if email?matches("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$")>
<#if str != "[">
<#local str += ",">
</#if>
<#local str += "\"">
<#local str += email>
<#local str += "\"">
</#if>
</#list>
<#local str += "]">
<#return (str)>