Backreference constructs allow a previously matched sub-expression to be identified subsequently in the same regular expression.
The following table lists these constructs:
Backreference construct | Description | Pattern | 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" |
No comments:
Post a Comment