From 256435e8e3c0ff3f3d0837ef5d899ba16446c6c9 Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Tue, 20 Jan 2015 18:23:54 -0500 Subject: [PATCH] Fix incorrect property check --- src/nre.nim | 2 +- test/misc.nim | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nre.nim b/src/nre.nim index 8bec3d9905..47e374978b 100644 --- a/src/nre.nim +++ b/src/nre.nim @@ -327,7 +327,7 @@ proc match*(str: string, pattern: Regex, start = 0, endpos = -1): RegexMatch = iterator findIter*(str: string, pattern: Regex, start = 0, endpos = -1): RegexMatch = # see pcredemo for explaination let matchesCrLf = pattern.matchesCrLf() - let unicode = bool(getinfo[cint](pattern, pcre.INFO_OPTIONS) and pcre.UTF8) + let unicode = (getinfo[cint](pattern, pcre.INFO_OPTIONS) and pcre.UTF8) > 0 let endpos = if endpos == -1: str.len else: endpos var offset = start diff --git a/test/misc.nim b/test/misc.nim index 529ea342e1..0b46a393b6 100644 --- a/test/misc.nim +++ b/test/misc.nim @@ -3,3 +3,5 @@ import unittest, nre suite "Misc tests": test "unicode": check("".find(re("", "8")).match == "") + check("перевірка".replace(re(r"\w", "uW"), "") == "") +