Skip to content

Commit 1b8f752

Browse files
kubo390xEAB
authored andcommitted
std.regex: document backreferences in the syntax table
The pattern syntax table listed named groups and referred to "direct numbers" in passing, but had no entry for backreferences themselves, making them look unsupported. Add a row describing `\1`, `\2`, ..., including the multi-digit case.
1 parent 2285aed commit 1b8f752

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

std/regex/package.d

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ They met on 24/01/1970.
211211
When referring to a matched portion of text,
212212
names work like aliases in addition to direct numbers.
213213
)
214+
$(REG_ROW \1$(COMMA) \2 ..., Backreference: matches the same text most
215+
recently captured by the capturing group with that number. Groups are
216+
numbered from 1 by the position of their opening parenthesis. A
217+
multi-digit reference such as \12 denotes group 12 when at least that
218+
many capturing groups precede it. )
214219
$(REG_TITLE Assertions, Match position rather than character )
215220
$(REG_ROW ^, Matches at the beginning of input or line (in multiline mode).)
216221
$(REG_ROW $, Matches at the end of input or line (in multiline mode). )

0 commit comments

Comments
 (0)