diff --git a/lib/impure/re.nim b/lib/impure/re.nim index b2283a8a1fb52..dae0aefb60019 100644 --- a/lib/impure/re.nim +++ b/lib/impure/re.nim @@ -219,20 +219,20 @@ proc findBounds*(buf: cstring, pattern: Regex, var rtarray = initRtArray[cint](3) rawMatches = rtarray.getRawData - res = pcre.exec(pattern.h, pattern.e, buf, bufSize.cint, start.cint, 0'i32, + res = pcre.exec(pattern.h, pattern.e, buf, bufSize.cint, start.cint, flags, cast[ptr cint](rawMatches), 3) if res < 0'i32: return (-1, 0) return (int(rawMatches[0]), int(rawMatches[1]-1)) proc findBounds*(s: string, pattern: Regex, - start = 0): tuple[first, last: int] {.inline.} = + start = 0, flags = int32(0)): tuple[first, last: int] {.inline.} = ## returns the `first` and `last` position of `pattern` in `s`. ## If it does not match, `(-1,0)` is returned. ## ## Note: there is a speed improvement if the matches do not need to be captured. runnableExamples: assert findBounds("01234abc89", re"abc") == (5,7) - result = findBounds(cstring(s), pattern, start, s.len) + result = findBounds(cstring(s), pattern, start, s.len, flags) proc matchOrFind(buf: cstring, pattern: Regex, start, bufSize: int, flags: cint): cint = var