Thanks to everyone who contributed to this topic.

I've noticed that not all of the regex patterns contain "&" (ampersand). 
According to Wikipaedia (and the standards mentioned therein), ampersands are 
allowed. Also, not all email servers have adopted the full standard (just bits 
that suit them) and so it seems a definitive pattern is probably impossible.

Confusing, isn't it?


________________________________
 From: Mike Copeland <[email protected]>
To: [email protected] 
Sent: Tuesday, 7 January 2014, 20:17
Subject: Re: Regular Expression Search
 

Dunno how good (or bad) it is, but this has worked well for me...
(careful on the "oRE.Pattern=" line that it doesn't wrap)

LPARAMETERS pcEmail as String
pcEmail = ALLTRIM(pcEmail)
Local oRE
oRE = CreateObject("VBScript.RegExp")
oRE.Pattern = 
"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
llresult = oRE.test(pcEmail)
RETURN llresult

I don't remember where I got it, so kudos to whoever wrote it.

Mike Copeland

-------- Original Message --------
Subject: Re: Regular Expression Search
From: Darren <[email protected]>
To: [email protected]
Date: 1/7/2014 2:11 PM
>> and "." (period) occurs at least once.
> Should be
> llValid = (Occurs("@", lcAddress) = 1) and (Occurs(".", lcAddress) >0)
>
> -----Original Message-----
> From: ProfoxTech [mailto:[email protected]] On Behalf Of Alan
> Bourke
> Sent: Wednesday, 8 January 2014 3:14 AM
> To: [email protected]
> Subject: Re: Regular Expression Search
>
>
>
> On Tue, Jan 7, 2014, at 03:36 PM, Laurie Alvey wrote:
>> I am trying to do some basic format validation on a string which
>> purports to be an email address. I want test that "@" occurs once and
>> once only and "." (period) occurs at least once.
> If it's as simple as that then:
>
> llValid = (Occurs("@", lcAddress) = 1) and (Occ[excessive quoting removed by 
> server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to