I have a very old (2001) email address validation function from Ricardo (see below) that was created before the full regEx was added to the engine. Now that we have a better regEx engine I suspect we could vastly simply this... does anyone have an upgrade written in xTalk with Revolution regEx they could share? I see in formMail.pl (which I'm abandoning) a pretty terse function but I don't know if this is a good validation or not nor if I can repurpose the perl regEx to xTalk -- i'll try but I'm a regEx baby hoping for a hand out.... ;-)


TIA

Sannyasin Sivakatirswami
Himalayan Academy Publications
at Kauai's Hindu Monastery
[EMAIL PROTECTED]

www.HimalayanAcademy.com,
www.HinduismToday.com
www.Gurudeva.org
www.Hindu.org

======= from perl:

# If the e-mail address contains: #
if ($email =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ ||


# the e-mail address contains an invalid syntax. Or, if the #
# syntax does not match the following regular expression pattern #
# it fails basic syntax verification. #


$email !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {

# Basic syntax requires: one or more characters before the @ sign, #
# followed by an optional '[', then any number of letters, numbers, #
# dashes or periods (valid domain/IP characters) ending in a period #
# and then 2 or 3 letters (for domain suffixes) or 1 to 3 numbers #
# (for IP addresses). An ending bracket is also allowed as it is #
# valid syntax to have an email address like: [EMAIL PROTECTED] #


# Return a false value, since the e-mail address did not pass valid #
# syntax. #
return 0;
}


    else {

# Return a true value, e-mail verification passed. #
return 1;
}


========= old xtalk validator from Ricardo




function isWellFormedMailtoScheme email
#- function isWellFormedMailtoScheme(email)
# return TRUE if email is a legal email URI, else return FALSE
# We are not actually *validating* the email address, only its syntax.
# Per address specification rules of RFC822: Standard for ARPA Internet Text Messages
# http://www.w3.org/Protocols/rfc822/Overview.html


  # Basic syntax requires: one or more characters before the @ sign,

split email by "@"
if extents(email) <> "1,2" then return false # only 1 @-sign is permitted
put email[2] into hostanddomain


  # There are 2 options to check, domain-literal or domain-logical:


# domain-literal option:
# primitive network host address form, must have [###.###.###.###] where 0 < # < 256
if char 1 of hostanddomain = "[" then
if not last char of hostanddomain = "]" then return false
delete char 1 of hostanddomain
delete last char of hostanddomain
set the itemDel to "."
if the num of items of hostanddomain <> 4 then return false
repeat with x = 1 to 4
if not isNumber(item x of hostanddomain) then return false
if item x of hostanddomain > 255 or item x of hostanddomain < 1 then return false
end repeat
return TRUE
end if


# domain-logical option: (the "normal" form)
# this permits an arbitrary number of strings separated by ".", ending in a domain name
set the itemDel to "."
put the num of items of hostanddomain into hostanddomainItems
if hostanddomainItems = 0 then return false
if hostanddomain contains ".." then return false # empty hosts not allowed
repeat with x = length(hostanddomain) down to 1
if not ("0123456789.-abcdefghijklmnopqrstuvwxyz_" contains char x of hostanddomain) \
then return false
end repeat
return TRUE
end isWellFormedMailtoScheme


_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to