--------------- cronan gogarty wrote: ---------------
: uh oh!
:
: OK what we have here is a dll that validates an email
: address entered into a webpage.
: Whoever wrote it decided it would be wise to use a
: regular expression like so,
:
: "^[_a-z0-9-]+(\.[_a-z0-9-]+)[EMAIL PROTECTED](\.[a-z0-9-]+).*$"
:
: now I have been requested to allow users to have an
: apostrophe "'" in their email address.
: I have looked at documentation regarding reqular
: expressions and I figured that if I used the
: following;
:
: "^[_a-z0-9-]+(\.[_a-z0-9-\']+)[EMAIL PROTECTED](\.[a-z0-9-]+).*$"
:
: it should work.
: It doesnt!
:
: Any regular expression gurus out there?
Cronan,
Here's the monstro-destructo regex I use to validate email addy's:
^(([^\[\]()<>@,;:\\".]+|"([^"\\]|\\.)*")*(?<angle><))?((?!\.)(\.?[^\[\]()<>@,;:\\".
]+)+|"([^"\\]|\\.)*")@(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]{2,}|\[(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d)){4}|[a-zA-Z\d\-]*[a-zA-Z\d]:([^\\\[\]]|\\.)+)\])(?(angle)>)$
validates to RFC 2822, which allows apostrophes. Please don't ask me
to explain it :), its from RegExLib[1].
enjoi!
Stephen
[1] http://regexlib.com/REDetails.aspx?regexp_id=711
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.