Re: RegExp irregularity in JScript
From: Roland Hall (nobody_at_nowhere)
Date: 03/04/04
- Next message: Sunny: "request is undefined"
- Previous message: Stefan Nagel: "Script to read out the User"
- Next in thread: Bryan Donaldson: "Re: RegExp irregularity in JScript"
- Reply: Bryan Donaldson: "Re: RegExp irregularity in JScript"
- Maybe reply: Steve Fulton: "Re: RegExp irregularity in JScript"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 4 Mar 2004 05:41:15 -0600
: "Bryan Donaldson" wrote in message
news:%23uBdzXVAEHA.916@tk2msftngp13.phx.gbl...
: We have a web page on which we're trying to validate an entry, and we're
: using Regular Expressions to do it. We've implemented a test page when
: takes a pattern and an string, and tells us whether the string matches the
: pattern when the user clicks a button.
:
<!--SNiP-->
: But - when we validate some strings using this code, we're not getting the
: behavior we expect.
:
: For exampe, a password-validating pattern such as (has to be between 4 and
8
: characters, containing at least digit, one lower case and one upper case
: letter) would be
: ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$
:
: Now, when we use the test value
:
: Expression : aA1234 we get a successful match.
:
: Expression : aA123 is NOT a match (by the logic above).
:
: Expression : 1234aA is NOT a match..
-=[Please only use plain text when posting to newsgroups.]=-
Try this:
http://guysare.us/lab/bryandonaldson.html?str=aA1234
http://guysare.us/lab/bryandonaldson.html?str=aA123
http://guysare.us/lab/bryandonaldson.html?str=1234aA
or try your own string to test...
HTH...
-- Roland Hall /* This information is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. */ Technet Script Center - http://www.microsoft.com/technet/scriptcenter/ WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp MSDN Library - http://msdn.microsoft.com/library/default.asp
- Next message: Sunny: "request is undefined"
- Previous message: Stefan Nagel: "Script to read out the User"
- Next in thread: Bryan Donaldson: "Re: RegExp irregularity in JScript"
- Reply: Bryan Donaldson: "Re: RegExp irregularity in JScript"
- Maybe reply: Steve Fulton: "Re: RegExp irregularity in JScript"
- Messages sorted by: [ date ] [ thread ]