summary refs log tree commit diff stats
path: root/src/nre.nim
diff options
context:
space:
mode:
authorFlaviu Tamas <tamasflaviu@gmail.com>2015-01-19 07:38:09 -0500
committerFlaviu Tamas <tamasflaviu@gmail.com>2015-01-19 07:38:09 -0500
commita938d42334822b78d4f84417d066f0f059dcf8ec (patch)
tree4a52fcf3c4d82751c040bc8099d8ecf82ae04669 /src/nre.nim
parent04699a7587dc83d37bd5e1618409cac11dc04f75 (diff)
downloadNim-a938d42334822b78d4f84417d066f0f059dcf8ec.tar.gz
Fix maxsplit to conform to perl
Diffstat (limited to 'src/nre.nim')
-rw-r--r--src/nre.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nre.nim b/src/nre.nim
index d907cae62..9e1a6a64e 100644
--- a/src/nre.nim
+++ b/src/nre.nim
@@ -417,7 +417,7 @@ proc split*(str: string, pattern: Regex, maxSplit = -1): seq[string] =
       # if there are captures, include them in the result
       result.add(cap)
 
-    if splits == maxSplit:
+    if splits == maxSplit - 1:
       break
 
   # last match: Each match takes the previous substring,