Fix upper bound handling
This commit is contained in:
parent
4a67b723a0
commit
01e22abb19
1 changed files with 3 additions and 1 deletions
|
|
@ -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 = newSeq[Slice[cint]](ceil(vecsize / 2).int)
|
||||||
result.pcreMatchBounds.setLen(vecsize div 3)
|
result.pcreMatchBounds.setLen(vecsize div 3)
|
||||||
|
|
||||||
|
let strlen = if endpos == -1: str.len else: endpos
|
||||||
|
|
||||||
let execRet = pcre.exec(pattern.pcreObj,
|
let execRet = pcre.exec(pattern.pcreObj,
|
||||||
pattern.pcreExtra,
|
pattern.pcreExtra,
|
||||||
cstring(str),
|
cstring(str),
|
||||||
cint(max(str.len, endpos)),
|
cint(strlen),
|
||||||
cint(start),
|
cint(start),
|
||||||
cint(flags),
|
cint(flags),
|
||||||
cast[ptr cint](addr result.pcreMatchBounds[0]),
|
cast[ptr cint](addr result.pcreMatchBounds[0]),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue