Subject: | Re: isEmailAddress()
| Date: | Tue, 30 Jul 2019 09:24:53 -0400
| From: | "Steven Green" <greens@diamondsg.com>
| Newsgroups: | pnews.paradox-programming
|
here's one I built over time.. for now, it seems to be ok.. bear in mind,
the one you found is most likely driving the "hyperlink" logic in the actual
table fields.. there are always some good ones that don't turn blue, right?
method ValidateEmailAddress(mymail string) logical
var
didlog logical
endvar
; adapted from Email Broadcast validation process
didlog = false
; Apr-19, the original process did ltrim/rtrim before testing the rules
; May-18, changed advmatch to tc2 field, it's already trimmed
; May-18, replace * with + in advmatch
; if advMatch(tc2.email,"^([^\\@]*)\\@([^\\@.]*).([^\\@]*)$") then
tc2.link = "" else tc2.link = "X" endif
if not advMatch(mymail,"^([^\\@]+)\\@([^\\@.]+).([^\\@]+)$") then
return didlog endif
; below, we can add any specific exclusions we come across
; May-18, it doesn't catch an address that ends with a dot (i.e.
"me@gmail." is valid)
if mymail.substr(mymail.size(),1) = "@" then return didlog endif
if mymail.substr(mymail.size(),1) = "." then return didlog endif
; May-18, it doesn't catch an address that starts with an @ (i.e.
"@gmail.com" is valid)
if mymail.substr(1,1) = "." then return didlog endif
if mymail.substr(1,1) = "@" then return didlog endif
; May-18, it doesn't catch a space in the string(i.e. "me @gmail.com"
is valid)
if mymail.search(" ") > 0 then return didlog endif
; Dec-18, it doesn't catch a comma in the string(i.e. "me@gmail,com" is
valid)
if mymail.search(",") > 0 then return didlog endif
didlog = true
return didlog
endMethod
--
Steven Green
Myrtle Beach, South Carolina, USA
http://www.OasisTradingPost.com
Collectibles and Memorabilia
Vintage Lego Sets and Parts
- and Paradox support, too
"Kevin Baker" wrote in message news:5d3f05af$1@pnews.thedbcommunity.com...
Steven / Mark,
Didn't think about more than one ".", and when I test using more than
one "." it returns false.
I've been breaking the email into two parts using an array.. some code I
found on here which works well. As they say, if it ain't broke don't
fix it.
Thanks
Kevin
|