Ad
  • Custom User Avatar

    This is mostly right but I would like to offer a couple of small corrections:

    * Means to match the preceding expression zero OR MORE times. In this case where it follows '.' it allows for any number of random characters.

    \1 Refers back to your match for the last expression in parentheses. In this case this means the character that matched '(\w)'.

    In total '(\w).*\1' equates to: An alphanumeric character, '\w', followed by any number of random characters, '.*', followed by the same alphanumeric character again, '\1'