Re: RegExp irregularity in JScript

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Roland Hall (nobody_at_nowhere)
Date: 03/05/04

  • Next message: Bryan Donaldson: "Re: RegExp irregularity in JScript"
    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.


  • Next message: Bryan Donaldson: "Re: RegExp irregularity in JScript"

    Relevant Pages

    • Re: Sorted Fixed Length String
      ... >I have a String of Numerical Digits Created Using Concatenate. ... >The Strings could be from 6 Characters in Length to 11 Characters in ... >The Least Characters in a String with a Digit GREATER than 1 can ONLY be ... Dim str As String ...
      (microsoft.public.excel.programming)
    • Re: Use parentheses in translation strings
      ... I want to replace the 4 digit ... You say you're doing this "for grouping in string matching later". ... single characters for other characters, ... To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx ...
      (perl.beginners)
    • Re: RegExp irregularity in JScript
      ... > characters, containing at least digit, one lower case and one upper case ... of characters (i.e. digits, lower case, upper case) in the string is at least 4 ...
      (microsoft.public.scripting.jscript)
    • Re: numeric sorting on a char field having a decimal
      ... We also need to know what to do if there's a second dot in the string, ... separates non-empty digit strings. ... sequence and the characters after the dot are in ascending numerical ...
      (comp.databases.informix)
    • detecting unwanted characters
      ... characters) contains any characterother than alpha (upper and lower ... case), digit, period, dash, or underscore. ...
      (microsoft.public.access.queries)