Re: regExp to verify email address
You're welcome, Sivakatirswami. I, too, prefer to use regular expressions, and based much of my dissertation project years ago using Perl regExps in convoluted ways, but MC's regExp parser has some issues. That will be addressed in a future version, so a func call is more reliable and visible. Sivakatirswami <[EMAIL PROTECTED]> wrote: on 10/4/01 7:15 PM, Ricardo at [EMAIL PROTECTED] wrote:> 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.htmlWell, Thank you! a bit of a switch though insofar as the code is muchmore verbose than the two regEx checks made by formMail.pl...but at least Iunderstand it and it works. Thanks again. One step closer to a robust htmlform mail processor...Hinduism TodaySivakatirswamiEditor's Assistant/Production Manager[EMAIL PROTECTED] www.HinduismToday.com, www.HimalayanAcademy.com! ,www.Gurudeva.org, www.hindu.orgArchives: http://www.mail-archive.com/metacard@lists.runrev.com/Info: http://www.xworlds.com/metacard/mailinglist.htmPlease send bug reports to <[EMAIL PROTECTED]>, not this list.Francisco J. Ricardo, Ph.D.Do You Yahoo!? NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. Yahoo! by Phone.
Re: regExp to verify email address
on 10/4/01 7:15 PM, Ricardo at [EMAIL PROTECTED] wrote: > 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 Well, Thank you! a bit of a switch though insofar as the code is much more verbose than the two regEx checks made by formMail.pl...but at least I understand it and it works. Thanks again. One step closer to a robust html form mail processor... Hinduism Today Sivakatirswami Editor's Assistant/Production Manager [EMAIL PROTECTED] www.HinduismToday.com, www.HimalayanAcademy.com, www.Gurudeva.org, www.hindu.org Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to <[EMAIL PROTECTED]>, not this list.
Re: regExp to verify email address
At 5:19 PM -1000 10/3/01, Sivakatirswami wrote: >It appears obvious that at least I have to "unspecialize" PERL special >characters by removing the forward slashes for: >@,[ and then the second If I remember correctly, the regEx engine used in MetaCard has a doesn't properly escape square brackets: \] won't work. It might be possible to work around the limitation. A replacement regEx engine is planned for a future version of MC. regards, Geoff Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to <[EMAIL PROTECTED]>, not this list.
Re: regExp to verify email address
Call the following address syntax verification function with your email as its param. It returns TRUE for well-formed (RFC822-compliant) email address syntax: 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 o! f 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 TRUEend isWellFormedMailtoScheme Sivakatirswami <[EMAIL PROTECTED]> wrote: Anyone have a set of regExp for use in a matchText function in MC to verifyan email address? I am converting some PERL form cgi's to Metatalkscripts...all very easy with the exception of this one function.The PERL script makes two matchText passes:First: $email !~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ ||Second: $email !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) {I was successful in rewriting the first one:e.g. put "[EMAIL PROTECTED]" into tEmailput matchtext (tEmail, "@.*@|\.\.|(@\.)|\.@|^\.")--returns false as it should...--it appears it is just checking--for double entries of periods or @ signsBut the second one is much more difficult... where PERL's regExuses a bracket feature to specify a range limit...put matchtext (tEmail,"^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9! ]{1,3})(\]?)$")Here's the full comments from BformMail.pl# /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ ||# 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: user@[255.255.255.0] ## Return a false value, since the e-mail address did not pass valid ## syntax. #return 0;This is the first time in my whole life attempting to use regEx...It appears obvious that at least I have to "unspecialize" PERL specialcharacters by removing the forward slashes for:@,[ and then the secondregEx looks like this in MetaTalk:(tEmail, "^.+@([?)[a-zA-Z0-9-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(]?)$")but the "then 2 or 3 letters (for domain suffixes) or 1 to 3 numbers" whichare using the {2,3} {1,3} don't seem to work in metaTalk...also, how do you match a space in a metatalk regExp?Now, I am not "wedded" to using a PERL syntax conversion if someone alreadyhas done this with a whole different strategy... Whatever works.Hinduism TodaySivakatirswamiEditor's Assistant/Production Manager[EMAIL PROTECTED] www.HinduismToday.com, www.HimalayanAcademy.com,www.Gurudeva.org, www.hindu.orgStatement on America Under AttackAnd August 2000 Address made at the United Nationson Stopping the War in the Home:http://www.saivasiddhanta.o! rg/hawaii/church/policy/attack_on_america_9112001.htmlArchives: http://www.mail-archive.com/metacard@lists.runrev.com/Info: http://www.xworlds.com/metacard/mailinglist.htmPlease send bug reports to <[EMAIL PROTECTED]>, not this list.Francisco J. Ricardo, Ph.D.Do You Yahoo!? NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. Yahoo! by Phone.
regExp to verify email address
Anyone have a set of regExp for use in a matchText function in MC to verify an email address? I am converting some PERL form cgi's to Metatalk scripts...all very easy with the exception of this one function. The PERL script makes two matchText passes: First: $email !~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ || Second: $email !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/) { I was successful in rewriting the first one: e.g. put "[EMAIL PROTECTED]" into tEmail put matchtext (tEmail,"@.*@|\.\.|(@\.)|\.@|^\.") --returns false as it should... --it appears it is just checking --for double entries of periods or @ signs But the second one is much more difficult... where PERL's regEx uses a bracket feature to specify a range limit... put matchtext (tEmail, "^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$") Here's the full comments from BformMail.pl # /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ || # 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: user@[255.255.255.0] # # Return a false value, since the e-mail address did not pass valid # # syntax.# return 0; This is the first time in my whole life attempting to use regEx... It appears obvious that at least I have to "unspecialize" PERL special characters by removing the forward slashes for: @,[ and then the second regEx looks like this in MetaTalk: (tEmail, "^.+@([?)[a-zA-Z0-9-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(]?)$") but the "then 2 or 3 letters (for domain suffixes) or 1 to 3 numbers" which are using the {2,3} {1,3} don't seem to work in metaTalk... also, how do you match a space in a metatalk regExp? Now, I am not "wedded" to using a PERL syntax conversion if someone already has done this with a whole different strategy... Whatever works. Hinduism Today Sivakatirswami Editor's Assistant/Production Manager [EMAIL PROTECTED] www.HinduismToday.com, www.HimalayanAcademy.com, www.Gurudeva.org, www.hindu.org Statement on America Under Attack And August 2000 Address made at the United Nations on Stopping the War in the Home: http://www.saivasiddhanta.org/hawaii/church/policy/attack_on_america_9112001 .html Archives: http://www.mail-archive.com/metacard@lists.runrev.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to <[EMAIL PROTECTED]>, not this list.