From ec6e26735132fe2a67e4c4bb74f92059d0530ce4 Mon Sep 17 00:00:00 2001 From: Grzegorz Adam Hankiewicz Date: Tue, 16 Jul 2013 02:00:25 +0200 Subject: [PATCH] Warns to not modify string findAll is iterating over. --- lib/impure/re.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/impure/re.nim b/lib/impure/re.nim index ef02a3b1d3..b92d39bf02 100644 --- a/lib/impure/re.nim +++ b/lib/impure/re.nim @@ -201,7 +201,10 @@ proc find*(s: string, pattern: TRegEx, start = 0): int = return rawMatches[0] iterator findAll*(s: string, pattern: TRegEx, start = 0): string = - ## yields all matching *substrings* of `s` that match `pattern`. + ## Yields all matching *substrings* of `s` that match `pattern`. + ## + ## Note that since this is an iterator you should not modify the string you + ## are iterating over: bad things could happen. var i = int32(start) var rawMatches: array[0..maxSubpatterns * 3 - 1, cint] while true: