regular expressions with validators

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
Back
Top