Fix upper bound handling

This commit is contained in:
Flaviu Tamas
2015-01-16 19:22:21 -05:00
parent 4a67b723a0
commit 01e22abb19

View File

@@ -301,10 +301,12 @@ proc matchImpl(str: string, pattern: Regex, start, endpos: int, flags: int): Reg
result.pcreMatchBounds = newSeq[Slice[cint]](ceil(vecsize / 2).int)
result.pcreMatchBounds.setLen(vecsize div 3)
let strlen = if endpos == -1: str.len else: endpos
let execRet = pcre.exec(pattern.pcreObj,
pattern.pcreExtra,
cstring(str),
cint(max(str.len, endpos)),
cint(strlen),
cint(start),
cint(flags),
cast[ptr cint](addr result.pcreMatchBounds[0]),