A backreference makes a later part of a regular expression match the text captured earlier—not just any text from the same character set. Write it as a backslash followed by the capture number, such as \1. section 10.2.2
Match the same character twice
In /^([dtn])a\1/, the first character is captured; after the a, \1 requires that exact character again. For example, the pattern matches "dad" and "tat", but not "dat". section 10.2.2
/<(\w+)>(.+)<\/\1>/
This pattern captures an opening tag name with (\w+), then uses \1 to require the closing tag to repeat it. It matches simple elements such as <strong>whatever</strong>; it does not establish support for nested markup. section 10.2.2

