diff options
Diffstat (limited to 'Src/pattern.c')
-rw-r--r-- | Src/pattern.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Src/pattern.c b/Src/pattern.c index 15b0bd746..c66f73451 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -1861,6 +1861,9 @@ pattrylen(Patprog prog, char *string, int len, int unmetalen, int offset) * backreferences. On entry, *nump should contain the maximum number * of positions to report. In this case the match, mbegin, mend * arrays are not altered. + * + * If nump is NULL but endp is not NULL, then *endp is set to the + * end position of the match, taking into account patinstart. */ /**/ @@ -2222,6 +2225,13 @@ pattryrefs(Patprog prog, char *string, int stringlen, int unmetalen, setaparam("mend", mendarr); } + if (!nump && endp) { + /* + * We just need the overall end position. + */ + *endp = CHARSUB(patinstart, patinput) + patoffset; + } + ret = 1; } else ret = 0; |