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/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to