FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour email
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
email
Posted: Mon May 25, 2015 04:13 PM

exist with fwh/xharbour a function to control if the string past is really a email ?
type see if there is the @ on a string ...

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 682
Joined: Tue Feb 14, 2006 09:48 AM
Re: email
Posted: Mon May 25, 2015 04:17 PM
You can use regular expression.
Code (fw): Select all Collapse
hb_regex(hb_regexComp(cRegExpression,cEmail) )
Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: email
Posted: Mon May 25, 2015 04:34 PM

thank but on cRegExpression what I must insert ?

or
I made a substr to have the second part of mail because I search a smtp server on my archive
sample

silvio.falconi@gmail.com - SubStr( cMailMittente, at(@, cMailMittente) ) - @gmail.com

I could see the first chr is a @ ...just an idea ....

>"">""
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: email
Posted: Mon May 25, 2015 04:55 PM

I found on xharbour reference this sample :
// The example tests if a text string contains an eMail address.
// The search is case insensitive although the RegEx defines
// character classes only with upper case letters.

PROCEDURE Main
LOCAL cRegEx := "[A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z]{2,4}"
LOCAL cText := "Send your request to info@xharbour.com " + ;
"for more information"

  IF HB_RegExMatch( cRegEx, cText, .F. )
     ? "Text contains eMail address"
  ELSE
     ? "Text contains no eMail address"
  ENDIF

RETURN

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion