Indeed, very good and with one line, Top !!
I wanted to go one step further, but this does not work, because I don't untherstand
what the function is doing ? Could you explane the process ?
What I tried : Get all the emails out of the string
- Code: Select all Expand view RUN
function extractonline
() local aMails:=
{} LOCAL cRegEx :=
"[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}" LOCAL cEmail, nStart, nLen
Local cText :=
"Send your request to 'mailto:info@dbm-essen.be>info@dbm-essen.be '" + ;
"for more information or to 'mailto:info@dbm-essen.be>info@dbm-essen.be ' and finaly to info@maveco.be" do while at("@",cText
) >
0 ? cText
cEmail := HB_AtX
( cRegEx, cText, .F., @nStart, @nLen
) ? cEmail
AADD
(aMails,cEmail
) cText =
substr(cText,
at("@",cText
)+1) enddo xbrowser
(aMails
)return
Perl-5 compatible RegEx:
------------------------
xHarbour includes PCRE which is a full feature, Perl 5 compatible, Regular
Expression engine. Full feature Search & Replace classes are currently under
construction, but you may already use the full power of RegEx searches,
new operators, HAS and LIKE.
cExp HAS cPatern|RegEx => bFound
cExp LIKE cPatern|RegEx => bLike
As well as full featured Functions:
HB_Atx( <cRegEx>, <cTargetString> [, lCaseSensitive [, [@]nStart ]
[, [@]nLen ] ] ] ) => cFoundText