diff options
author | Araq <rumpf_a@web.de> | 2018-10-11 16:15:16 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-10-11 16:15:35 +0200 |
commit | 8ab6fa1be255e91f4a455f5e4a97aff07c12d84c (patch) | |
tree | 86fa8913d71d669ae9c42ed768a7320b8803f569 /lib/impure/re.nim | |
parent | 160f8599c6836f5ade1ba35321141d8de94581f7 (diff) | |
download | Nim-8ab6fa1be255e91f4a455f5e4a97aff07c12d84c.tar.gz |
fixes #9306
Diffstat (limited to 'lib/impure/re.nim')
-rw-r--r-- | lib/impure/re.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/impure/re.nim b/lib/impure/re.nim index a60f70828..e621162d0 100644 --- a/lib/impure/re.nim +++ b/lib/impure/re.nim @@ -428,7 +428,7 @@ proc replace*(s: string, sub: Regex, by = ""): string = ## "; " result = "" var prev = 0 - while true: + while prev < s.len: var match = findBounds(s, sub, prev) if match.first < 0: break add(result, substr(s, prev, match.first-1)) @@ -453,7 +453,7 @@ proc replacef*(s: string, sub: Regex, by: string): string = result = "" var caps: array[MaxSubpatterns, string] var prev = 0 - while true: + while prev < s.len: var match = findBounds(s, sub, caps, prev) if match.first < 0: break add(result, substr(s, prev, match.first-1)) |