Find e-mail addresses in text

Share your macros, knowledge, solutions, services, ...
Post Reply
Petr
Posts: 106
Joined: Tue Oct 18, 2016 1:12 pm

Find e-mail addresses in text

Post by Petr » Wed Nov 23, 2016 6:11 pm

This macro sample shows how to find e-mail address in text.

Code: Select all

<#>This example shows how to find an e-mail addresses in input text
<cmds>

<form_item>("f1","Input text with e-mail addresses:","EDIT_ML10","This is a text that contains e-mail addresses 
such as john.a.smith@comp-comp-company.com 
or FredieX@dot.dot.TV or other....","vInputText",1)
<form_show>("f1","Insert text with e-mail addresses","",0,500,0,,,1,1)

<varset>("vSearchFrom=0","")
<for>("","1","")
<regex_find>("%vInputText%","\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}","%vSearchFrom%",vM,vI,vS)
<if>("%vM%==%_vStrEmpty%")
   <msg>(-100,-100,"No more e-mail addresses found.","",1,0,0,0)
   <for_break>
<else>
   <msg>(-100,-100,"E-mail found: %vM%
Position in text: %vI%
Length: %vS%","",1,0,0,0)
   <varset>("%vSearchFrom%=EXPR(%vI%+%vS%)","")
<endif>
<for_end>

Post Reply