QTP Forums

Full Version: Regular Expressions for e-mail address
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Hi all,
Can Any one please tell me which regular expression we can use to validate E-mail address in qtp??

Thnx in advance....
*@*.*
Hi
This is the reg Exp for E-Mail Address

".*@.*\.com"

Thanks
VENKATA
Hi,

For example

if your email Id is in the following format

abc.xyz@pqr.com

then use this : (\w+)(\.)(\w+)(\@)(\w+)(\.)(w+)


if your email Id is in the following format

abc_xyz@pqr.com

then use this : (\w+)(\_)(\w+)(\@)(\w+)(\.)(w+)

if your email Id is in the following format

abc.xyz@pqr.com or abc_xyz@pqr.com or abc-xyz@pqr.com
or abc@pqr.com
then use this :

((\w+)(\.|\_|\-)(\w+)|(\w+))(\@)(\w+)(\.)(w+)

Thanks,
Raja
(06-21-2009 03:23 PM)Raja Wrote: [ -> ]Guys, Sorry I forgot to attach "\" in the following Patterns.

The Updated one is as follows >

For example

if your email Id is in the following format

abc.xyz@pqr.com

then use this : (\w+)(\.)(\w+)(\@)(\w+)(\.)(\w+)


if your email Id is in the following format

abc_xyz@pqr.com

then use this : (\w+)(\_)(\w+)(\@)(\w+)(\.)(\w+)

if your email Id is in the following format

abc.xyz@pqr.com or abc_xyz@pqr.com or abc-xyz@pqr.com
or abc@pqr.com
then use this :

((\w+)(\.|\_|\-)(\w+)|(\w+))(\@)(\w+)(\.)(\w+)

Thanks,
Raja
(06-21-2009 03:23 PM)Raja Wrote: [ -> ]Hi,

For example

if your email Id is in the following format

abc.xyz@pqr.com

then use this : (\w+)(\.)(\w+)(\@)(\w+)(\.)(w+)


if your email Id is in the following format

abc_xyz@pqr.com

then use this : (\w+)(\_)(\w+)(\@)(\w+)(\.)(w+)

if your email Id is in the following format

abc.xyz@pqr.com or abc_xyz@pqr.com or abc-xyz@pqr.com
or abc@pqr.com
then use this :

((\w+)(\.|\_|\-)(\w+)|(\w+))(\@)(\w+)(\.)(w+)

Thanks,
Raja
(06-21-2009 03:23 PM)Raja Wrote: [ -> ]Guys, Sorry I forgot to attach "\" in the following Patterns.

The Updated one is as follows >

For example

if your email Id is in the following format

abc.xyz@pqr.com

then use this : (\w+)(\.)(\w+)(\@)(\w+)(\.)(\w+)


if your email Id is in the following format

abc_xyz@pqr.com

then use this : (\w+)(\_)(\w+)(\@)(\w+)(\.)(\w+)

if your email Id is in the following format

abc.xyz@pqr.com or abc_xyz@pqr.com or abc-xyz@pqr.com
or abc@pqr.com
then use this :

((\w+)(\.|\_|\-)(\w+)|(\w+))(\@)(\w+)(\.)(\w+)

Thanks,
Raja

Hi Ganesh,

Use this below Regular Expression pattern to match any valid email id.

sPattern="\b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b"

Thanks,
Azeem
Reference URL's