Validation Expression help (for expression that works on server but not client)

B

Brad

I need a regular expression + jscript guru. The validation expression
below is for a RegularExpressionValidatior on a password input. It works
perfectly on server side validation and in a utility I have to test Perl
compatible
expressions (Regex Coach). However it fails on the client side...the client
being my local IE6 browser. As best I can tell from my (msdn) jscript
syntax reference it
is legitimate.

^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s)[\x21-\x7E]{6,12}$

Any tweaking I did to get it to work on the client (tweaks that didn't make
sense) then broke it work on the
server side validation or in the Perl tester.

Any expression / jscript guru help would be appreciated.

Using VS2003 on win2k3 std and browsing with IE6.0.3790.0


Brad
 
S

Steven Cheng[MSFT]

Hi Brad,

Thanks for posting in the community!
From your description, you've generated a certain regex which is used to
validate password. This validation worked well using the dotnet regex
components on serverside but has some problem on clientside. Also, if you
modfy the regex so as to make it worked ok on clientside script, however it
won't on serverside code instead, yes?

As for this question, since you mentioned that you've made some tweak which
make it work on clientside script, would you please also share the tweaked
regex with us so as for us? Also, would you provide some further
description on the requreiment of your regex so that we could consider
whether there's any other means to construct the regex?

In addition, here is a site which provide a sample script to test the
browser's regex capability:

#JavaScript RegExp Example: Regular Expression Tester
http://www.regular-expressions.info/javascriptexample.html

Hope it helps.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
B

Brad

Thanks for replying Steven but this doesn't really answer my question, nor
the documentation at the web site referenced. I'll try a post to the
jscript news group.
 
B

Brad

Steven -
Response from microsoft.public.scripting.jscript indicates this is an IE
problem. Here's an excerpt from response in the group.

================================
The regular expression is correct, it's IE that is broken.

It seems IE 6 fails in some cases when using positive lookahead. There
was a recent thread about it in the Microsoft JScript group
<URL:The example used there was similar.

I am not sure enough about what conditions trigger the problem to
be able to suggest a workaround, so ... good luck :).

You could split the test into several simple tests, instead of one
big RegExp.
==================================

My workaround will be to use only server side validation for the specific
validation controls, which works correctly.
 

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

Top