Re: RegExp irregularity in JScript
From: Roland Hall (nobody_at_nowhere)
Date: 03/05/04
- Previous message: Roland Hall: "Re: RegExp irregularity in JScript"
- In reply to: Steve Fulton: "Re: RegExp irregularity in JScript"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 5 Mar 2004 13:47:45 -0600
"Steve Fulton" <cerberus40@hotmail.com> wrote in message
news:%23iM7ZHrAEHA.2720@TK2MSFTNGP11.phx.gbl...
: Bryan Donaldson wrote:
: > 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..
: >
: > Do you have any pointers on where we've messed up?
:
: From changing the minimum number of characters in the ".{4,8}" portion of
the
: pattern, it looks like the regular expression succeeds only if the *last
class*
: of characters (i.e. digits, lower case, upper case) in the string is at
least 4
: characters long. All three strings match if the pattern is ".{1,8}"; the
first
: two pass if it's ".{3,8}". What makes this behavior puzzling is if you
capture
: the pattern as a submatch (e.g. "(.{1,8})") the entire string is returned,
not
: just the end of the string!
:
: This looks like a bug in Microsoft's regular expression implementation (it
fails
: in VBScript as well). I'd tell them about it but they've halted
development of
: ActiveX scripting, and since this isn't a security issue I doubt a fix
will be
: forthcoming.
What I also couldn't do was put it into words where it made sense as you
just did. Thanks for jumping in and clearing it up.
- Previous message: Roland Hall: "Re: RegExp irregularity in JScript"
- In reply to: Steve Fulton: "Re: RegExp irregularity in JScript"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|