diff --git a/man3/regex.3 b/man3/regex.3 index 9c2bd06f5..bcc918a28 100644 --- a/man3/regex.3 +++ b/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