Add findAllStr

This commit is contained in:
Flaviu Tamas
2015-01-12 21:00:25 -05:00
parent 1652cdbaff
commit e0cdad635b

View File

@@ -362,6 +362,11 @@ proc find*(str: string, pattern: Regex, start = 0, endpos = -1): Option[RegexMat
proc findAll*(str: string, pattern: Regex, start = 0, endpos = -1): seq[RegexMatch] =
accumulateResult(str.findIter(pattern, start, endpos))
proc findAllStr*(str: string, pattern: Regex, start = 0, endpos = -1): seq[string] =
result = @[]
for match in str.findIter(pattern, start, endpos):
result.add(match.match)
proc renderBounds(str: string, bounds: Slice[int]): string =
result = " " & str & "\n"
for i in -1 .. <bounds.a: