views:

75

answers:

1

I have a regex that I am using in an asp.net RegularExpressionValidator to check a TextField.

^(?=.*[a-z])(?=.*\d)(?=.*[A-Z]).{8,}$

The example string I have stumbled on is 'RedCoal1'

Firefox = Matched
IE8 = Matched
Chrome = Matched

IE7 = DOES NOT MATCH

WHY!!!!

+5  A: 

The implementation of lookahead in WSH's RegExp as used by IE is just broken. The bug usually pops up in exactly this case, trying to use one regex to verify several things at once.

Plus some older browsers don't support lookahead at all (it wasn't in the original JavaScript spec, though it is now in ECMA-262-3). So all in all it's best to avoid lookahead in browser RegExp.

It would be best to separate out each check (each character class, and length) into manual validation steps.

bobince
Yes, I've the same experience.So what I did was to avoid client-side validation for that particular validator.
o.k.w