it's not entirely clear from your question what you want to do, but i'm assuming you're talking about e-mail addresses. trying to validate entire e-mail messages with a regular expression wouldn't make much sense, after all.
these days, Internet (SMTP) e-mail addresses are defined in RFC 2822, and you want to look in section 3.4. be aware that the actual syntax is a lot more complex and flexible than it seems at first glance. be aware, also, that not every piece of e-mail sending software in the world is all that strict about what types of things they call an "address", so you may encounter forms that do not fit the definition, and you'll have to try and cope with them.
Joined: Jan 02, 2002
Thanks for your reply.
Please eloborate why it does not make sense to use reg exp? "....trying to validate entire e-mail messages with a regular expression wouldn't make much sense, after all."
I am trying to add reg exp which should allow quoted user, for "firstname lastname"@host.com. This is what I have: RE emailPattern = new RE("((^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9])|([^\"*$\"]))@[a-z-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$");