diff options
author | Oleh Prypin <blaxpirit@gmail.com> | 2015-04-10 11:20:05 +0300 |
---|---|---|
committer | Oleh Prypin <blaxpirit@gmail.com> | 2015-04-10 15:34:22 +0300 |
commit | 16577f816749859f8d169ffbdd4415ca4747e75a (patch) | |
tree | e6476c419acd5e7752332b46c377f1f16af7a244 /src/nre.nim | |
parent | a66527919209d84e3143776636abf0b73c9ef3f7 (diff) | |
download | Nim-16577f816749859f8d169ffbdd4415ca4747e75a.tar.gz |
Fix zero-length matches for multibyte characters
Diffstat (limited to 'src/nre.nim')
-rw-r--r-- | src/nre.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nre.nim b/src/nre.nim index f9c6b3509..b601d8222 100644 --- a/src/nre.nim +++ b/src/nre.nim @@ -352,16 +352,16 @@ iterator findIter*(str: string, pattern: Regex, start = 0, endpos = int.high): R if match.isNone: # either the end of the input or the string # cannot be split here - offset += 1 - if matchesCrLf and offset < (str.len - 1) and str[offset] == '\r' and str[offset + 1] == '\l': # if PCRE treats CrLf as newline, skip both at the same time - offset += 1 + offset += 2 elif unicode: # XXX what about invalid unicode? offset += str.runeLenAt(offset) assert(offset <= strlen) + else: + offset += 1 else: offset = match.get.matchBounds.b + 1 |