Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Valid regular expression not working with validator control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew Jocelyn - 04 Mar 2008 14:55 GMT
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
Jesse Houwing - 05 Mar 2008 00:01 GMT
Hello Andrew,

> Hi
>
[quoted text clipped - 6 lines]
> 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$)restofthedomainregex$

--
Jesse Houwing
jesse.houwing at sogeti.nl
Andrew Jocelyn - 05 Mar 2008 11:37 GMT
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.

anyone@not-allowed-domain.com  fails
anyone@allowed-domain.com succeeds

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

Thanks again
Andrew

> Hello Andrew,
>
[quoted text clipped - 17 lines]
> Jesse Houwing
> jesse.houwing at sogeti.nl
Jesse Houwing - 05 Mar 2008 11:44 GMT
Hello Andrew,

> Hi
>
[quoted text clipped - 7 lines]
> anyone@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
[quoted text clipped - 21 lines]
>> Jesse Houwing
>> jesse.houwing at sogeti.nl
--
Jesse Houwing
jesse.houwing at sogeti.n

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.