A backreference allows a previously matched subexpression to be identified subsequently in the same regular expression. The following table lists the backreference constructs supported by regular expressions in the .NET Framework.
Pattern | Description | Sample | Matches |
\ number | Backreference. Matches the value of a numbered subexpression. | (\w)\1 | "ee" in "seek" |
\k<name> | Named backreference. Matches the value of a named expression. | (?<char>\w)\k<char> | "ee" in "seek" |