This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

email formatting

Old posts that have not been replied to for several years.
Locked
s
simonbell
Halfop
Posts: 68
Joined: Mon Aug 05, 2002 8:07 pm
Location: Washington, England
Contact:

email formatting

Post by simonbell »

Hi

could someone give me an example of how i could check is the format of an email address entered is correct. Ive been looking at the regexp page but i cant seem to figure it out.

thanks
Simon
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

Code: Select all

if {[regexp {.+@.+\..+} <text>]} { valid }
Wcc
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Re: email formatting

Post by egghead »

simonbell wrote:Hi

could someone give me an example of how i could check is the format of an email address entered is correct. Ive been looking at the regexp page but i cant seem to figure it out.

thanks
Simon
If you want to go beyond a one line regexp, you may end up writing an interesting tcl which does:

1. check if the email address is formatted according RFC 822.
2. check if a mail host for the address exists.

Perl modules exist for this functionality. An example:

http://aspn.activestate.com/ASPN/CodeDo ... Valid.html

If you find or write such a module in tcl, let it know! :)
Locked