try see compare understand learn JavaScript Regular Expressions
Backreferences

The contents of capturing groups can be referenced in the pattern using \N, where N is the group number or by \k<name>.

The common use cases for backreferencing are:

  • To find doubled words in a sentence as in "The sun rises in the the east".
  • To find words with doubled letters as in "successful", "bookkeeper".
  • To grab subtexts from texts separated by delimiters.