mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 11:42:33 +00:00
@@ -116,7 +116,7 @@ proc `[]`*(pattern: Captures, i: int): string =
|
||||
# capture count, plus the entire string
|
||||
pattern.matchCache = newSeq[string](pattern.pattern.captureCount + 1)
|
||||
if pattern.matchCache[i + 1] == nil:
|
||||
pattern.matchCache[i + 1] = pattern.str[bounds.a .. bounds.b-1]
|
||||
pattern.matchCache[i + 1] = pattern.str.substr(bounds.a, bounds.b-1)
|
||||
return pattern.matchCache[i + 1]
|
||||
else:
|
||||
return nil
|
||||
|
||||
@@ -19,3 +19,4 @@ suite "find":
|
||||
test "len 0 find":
|
||||
check("".findAll(re"\ ") == newSeq[string]())
|
||||
check("".findAll(re"") == @[""])
|
||||
check("word word".findAll(nre.re"\b") == @["", "", "", ""])
|
||||
|
||||
Reference in New Issue
Block a user