473,396 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1402
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: VSK | last post by:
Hi all, I have a .ascx file with dropdownbox (SSN, EmpName) textbox submit button regular expression validator( controltovalidate is the above textbox) Now i want to change the Regular...
2
by: S.Kartikeyan | last post by:
I have the following problem. I am using the follwing Regular Expression validator(REV) with validator expressions ^{1,2}$ ^{3,20}$ The idea of the first exp is 1 or 2 digits the idea of second...
2
by: Dot net work | last post by:
Hello. Say I have a .net textbox that uses a .net regularexpressionvalidator. If the regular expression fails, is it possible to launch a small client side javascript function to do something,...
5
by: John . | last post by:
I am using the Regular Expression Validator control to validate a correct email address. But, at the same time I would like to make it a required field. I tested by using just the regular...
2
by: kieran | last post by:
Hi, I am using Visual Studio 2005 and am trying to use a Regular Expression Validator control. I have a drop down list which contains various names, the first one is "Please Select". I want...
7
by: PJ6 | last post by:
Is it possible for a regular expression to macth only an empty string? What I want is exactly {0}, but that causes the parser to throw an exception - parsing "{0}" - Quantifier {x,y} following...
2
by: Joey | last post by:
Hello guys, I'm trying to learn about regular expressions. I need to be able to use an RE that can evaluate for STRINGS (or specific sequences of characters), not just occurances of characters....
0
by: durga2005 | last post by:
hi i just added one textbox and regular expression validator in the form and set the properties for regular expression validator control. then i placed these two controls inside update panel ....
1
by: durga2005 | last post by:
hi i have a textbox and regular expression validator control .i have placed these control inside update panel. just im validating the textbox with regular expression validator control when i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.