At 07:36 2014-01-07, Laurie Alvey <truk...@btinternet.com> 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. This is what I have tried:

Beware of partially validating data. Note that a regex is insufficient to validate an arbitrary E-mail address. There is a monster that almost does it and which is close to 2K long.

     Going by what you asked for above:

     Let ea be the E-mail address.  Then:
          at("@",ea)>0 and at("@",ea,2)=0 and at(".",ea)>0
ought to do (untested) what you asked for, but it will also accept:
          @.
          .@

Sincerely,

Gene Wirchenko


_______________________________________________
Post Messages to: ProFox@leafe.com
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/
** 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