Add captures in split

This commit is contained in:
Flaviu Tamas
2015-01-15 19:53:43 -05:00
parent a03d178a56
commit f88f4912c2

View File

@@ -408,6 +408,10 @@ proc split*(str: string, pattern: Regex): seq[string] =
lastIdx = bounds.b
for cap in match.captures:
# if there are captures, include them in the result
result.add(cap)
# last match: Each match takes the previous substring,
# but "1 2".split(/ /) needs to return @["1", "2"].
# This handles "2"