Ad
  • Custom User Avatar

    The regex picks any character followed by an uppercase letter and sets two groups

    \1 = [any character]

    \2 = [the uppercase letter that follows]

    Then it replaces this pattern by the format "\1_\2"

    So, for the string 'CodeWarsPascalCase' it will pick 'eW', 'rP' and 'lC' and replace with the new given pattern ('e_W', 'r_P' and 'l_C')

    Pretty clever, indeed.