regular expressions with validators

B

Bhaskardeep Khaund

Hi,

This should work:

^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$

Change the length you want (e.g. here it is minimum 2 character and maximum
9 characters)

Regards,
Bhaskar
 
B

Bhaskardeep Khaund

Hi Hayden,

I have been using this regex expression for IE 6.0 and above and
firefox......please look up this page:

http://msdn2.microsoft.com/en-us/library/ms998267.aspx

Regards,
Bhaskar



Hayden Kirk said:
Hi

Does not seem to work in IE or Firefox...

Hrm :/

Bhaskardeep Khaund said:
Hi,

This should work:

^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$

Change the length you want (e.g. here it is minimum 2 character and
maximum 9 characters)

Regards,
Bhaskar

Hayden Kirk said:
Hi,

I'm trying to validate an email address, which works, however, if there
is no text in the text box it still validates for some reason. Here is
the expression: \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

Thanks
 
B

Bhaskardeep Khaund

Hayden,

If you use this method, you can write Dispaly="Dynamic" in both the
validator controls, to remove the gap between the text of the error
messages.

Rgds,
Bhaskar


Hayden Kirk said:
Hi Peter,

If I use both, I get a gap between the validators, if you know what I
mean?

After the box I have the regxp validator, then the one that checks for
some input, is there a away to get around that?

Cheers,

Peter Bromberg said:
Add a RequiredValidator also.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




Hayden Kirk said:
Hi,

I'm trying to validate an email address, which works, however, if there
is
no text in the text box it still validates for some reason. Here is the
expression: \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

Thanks
 
H

Hans Kesting

Hi,
I'm trying to validate an email address, which works, however, if
there is no text in the text box it still validates for some reason.
Here is the expression: \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

Thanks

That is by design: except for the RequiredFieldValidator, all validators
treat an empty
field as "valid".

Hans Kesting
 
H

Hayden Kirk

Hi,

I'm trying to validate an email address, which works, however, if there is
no text in the text box it still validates for some reason. Here is the
expression: \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

Thanks
 
H

Hayden Kirk

Hi Peter,

If I use both, I get a gap between the validators, if you know what I mean?

After the box I have the regxp validator, then the one that checks for some
input, is there a away to get around that?

Cheers,

Peter Bromberg said:
Add a RequiredValidator also.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




Hayden Kirk said:
Hi,

I'm trying to validate an email address, which works, however, if there
is
no text in the text box it still validates for some reason. Here is the
expression: \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

Thanks
 
H

Hayden Kirk

Hi

Does not seem to work in IE or Firefox...

Hrm :/

Bhaskardeep Khaund said:
Hi,

This should work:

^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$

Change the length you want (e.g. here it is minimum 2 character and
maximum 9 characters)

Regards,
Bhaskar

Hayden Kirk said:
Hi,

I'm trying to validate an email address, which works, however, if there
is no text in the text box it still validates for some reason. Here is
the expression: \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

Thanks
 
H

Hayden Kirk

Ah, simple as that.

Thank you :)

Bhaskardeep Khaund said:
Hayden,

If you use this method, you can write Dispaly="Dynamic" in both the
validator controls, to remove the gap between the text of the error
messages.

Rgds,
Bhaskar


Hayden Kirk said:
Hi Peter,

If I use both, I get a gap between the validators, if you know what I
mean?

After the box I have the regxp validator, then the one that checks for
some input, is there a away to get around that?

Cheers,

Peter Bromberg said:
Add a RequiredValidator also.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




:

Hi,

I'm trying to validate an email address, which works, however, if there
is
no text in the text box it still validates for some reason. Here is the
expression: \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top