A.4 Backreferences

Backreferences are used to overcome the problem that one match has no knowledge of its previous match, appearing as a pair of a subexpression and a \number referencing to that subexpression.

Find all repeated words (often typos):

Another example with html data where we want to match all normal header tags, note that the last pair <h2>...<h3> is invalid:

Backreferences is particularly useful when performing replace operations.