parent
b5f3a662c5
commit
eb2fd618fe
2 changed files with 2 additions and 1 deletions
|
|
@ -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") == @["", "", "", ""])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue