mirror of https://github.com/mkerrisk/man-pages
regex.3: Clarify details of matching
The first is that it's far from clear that the end points of the complete string match are stored in the zero'th element of the regmatch_t array; secondly, the phrase "next largest substring match" is positively misleading, implying some sort of size ordering, whereas in fact they are ordered according to their appearance in the regex pattern. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
9105e83dac
commit
ea72c0cc8c
18
man3/regex.3
18
man3/regex.3
|
@ -93,7 +93,7 @@ Subsequent
|
|||
searches using this pattern buffer will be case insensitive.
|
||||
.TP
|
||||
.B REG_NOSUB
|
||||
Support for substring addressing of matches is not required.
|
||||
Do not report position of matches.
|
||||
The
|
||||
.I nmatch
|
||||
and
|
||||
|
@ -163,14 +163,26 @@ above)
|
|||
Unless
|
||||
.B REG_NOSUB
|
||||
was set for the compilation of the pattern buffer, it is possible to
|
||||
obtain substring match addressing information.
|
||||
obtain match addressing information.
|
||||
.I pmatch
|
||||
must be dimensioned to have at least
|
||||
.I nmatch
|
||||
elements.
|
||||
These are filled in by
|
||||
.BR regexec ()
|
||||
with substring match addresses.
|
||||
with substring match addresses. The offsets of the subexpression
|
||||
starting at the
|
||||
.IR i th
|
||||
open parenthesis are stored in
|
||||
.IR pmatch[i] .
|
||||
The entire regular expression's match addresses are stored in
|
||||
.IR pmatch[0] .
|
||||
(Note that to return the offsets of
|
||||
.I N
|
||||
subexpression matches,
|
||||
.I nmatch
|
||||
must be at least
|
||||
.IR N+1 .)
|
||||
Any unused structure elements will contain the value \-1.
|
||||
|
||||
The
|
||||
|
|
Loading…
Reference in New Issue