Back references

Use the following character classes to refer back to subexpressions in patterns and in replacement strings.

Character class Meaning
\1 Back reference to 1st parenthesized subexpression
\2 Back reference to 2nd parenthesized subexpression
\3 Back reference to 3rd parenthesized subexpression
\4 Back reference to 4th parenthesized subexpression
\5 Back reference to 5th parenthesized subexpression
\6 Back reference to 6th parenthesized subexpression
\7 Back reference to 7th parenthesized subexpression
\8 Back reference to 8th parenthesized subexpression
\9 Back reference to 9th parenthesized subexpression

Related Links