468,106 Members | 1,503 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,106 developers. It's quick & easy.

Valid regular expression not working with validator control

Hi

I get a JavaScript error with this expression when using the
RegExpValidator. Also if I switch off client script the server side code
validator finds a match regardless of the entered string.

(?<!@emailaddressnotallowed\.org)$

Is there a way of writing this so it works with the validator in both client
side and server side?

Thanks
Andrew
Mar 4 '08 #1
3 1257
Hello Andrew,
Hi

I get a JavaScript error with this expression when using the
RegExpValidator. Also if I switch off client script the server side
code validator finds a match regardless of the entered string.

(?<!@emailaddressnotallowed\.org)$

Is there a way of writing this so it works with the validator in both
client side and server side?
Look behinds are not supported in Client Side code. So you need to rewrite
this to either a full expression or to use a look ahead like this:

^regexuptothe@(?!emailaddressnotallowed\.org$)rest ofthedomainregex$

--
Jesse Houwing
jesse.houwing at sogeti.nl
Mar 5 '08 #2
Hi

thanks for the tip. I still can't get what I want to work. I'm using
Expresso to test.

Basically I want to make sure that if an input text includes a certain
domain then validation fails, e.g.

an****@not-allowed-domain.com fails
an****@allowed-domain.com succeeds

Please bear with me as I'm a complete novice with regular expressions.

Thanks again
Andrew
"Jesse Houwing" <je***********@newsgroup.nospamwrote in message
news:21**************************@news.microsoft.c om...
Hello Andrew,
>Hi

I get a JavaScript error with this expression when using the
RegExpValidator. Also if I switch off client script the server side
code validator finds a match regardless of the entered string.

(?<!@emailaddressnotallowed\.org)$

Is there a way of writing this so it works with the validator in both
client side and server side?

Look behinds are not supported in Client Side code. So you need to rewrite
this to either a full expression or to use a look ahead like this:

^regexuptothe@(?!emailaddressnotallowed\.org$)rest ofthedomainregex$

--
Jesse Houwing
jesse.houwing at sogeti.nl


Mar 5 '08 #3
Hello Andrew,
Hi

thanks for the tip. I still can't get what I want to work. I'm using
Expresso to test.

Basically I want to make sure that if an input text includes a certain
domain then validation fails, e.g.

an****@not-allowed-domain.com fails
an****@allowed-domain.com succeeds
Please bear with me as I'm a complete novice with regular expressions.
^[^@]+@(?!not-allowed-domain.com$).*$

should do, though it doesn't check the syntax of the email address itself,
it does exclude the domain you want.

Jesse

>
Thanks again
Andrew
"Jesse Houwing" <je***********@newsgroup.nospamwrote in message
news:21**************************@news.microsoft.c om...
>Hello Andrew,
>>Hi

I get a JavaScript error with this expression when using the
RegExpValidator. Also if I switch off client script the server side
code validator finds a match regardless of the entered string.

(?<!@emailaddressnotallowed\.org)$

Is there a way of writing this so it works with the validator in
both client side and server side?
Look behinds are not supported in Client Side code. So you need to
rewrite this to either a full expression or to use a look ahead like
this:

^regexuptothe@(?!emailaddressnotallowed\.org$)res tofthedomainregex$

--
Jesse Houwing
jesse.houwing at sogeti.nl
--
Jesse Houwing
jesse.houwing at sogeti.nl
Mar 5 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by John . | last post: by
2 posts views Thread by kieran | last post: by
7 posts views Thread by PJ6 | last post: by
2 posts views Thread by Joey | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.