#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2017
    Posts
    7
    Rep Power
    0

    What does (?=(?: mean in the match rule?


    For the rule

    Code:
    '^(?=[^a-z]*[a-z])(?=(?:[^A-Z]*[A-Z]){3})(?=\D*\d)\w{6,10}$'
    (?=(?:[^A-Z]*[A-Z]){3}) puzzled me.

    I understand the meaning of (?=(exp{3})) .

    What does (?: mean in (?=(?:exp{3})) ?
  2. #2
  3. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,382
    Rep Power
    9645
    It's grouping without capturing.
    Code:
    (a)(b) -> \1 is 'a' and \2 is 'b'
    (?:a)(b) -> \1 is 'b' and there is no \2

IMN logo majestic logo threadwatch logo seochat tools logo