Skip to content

Commit 0220570

Browse files
Make Unicode support the default for regexes [closes #696].
1 parent 75a2e9d commit 0220570

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

base/regex.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ Regex(p::String) = Regex(p, 0, false)
2727
# constructs are correctly handled.
2828

2929
macro r_str(pattern, flags...)
30-
options = 0
30+
options = PCRE_UTF8
3131
for fx in flags, f in fx
3232
options |= f=='i' ? PCRE_CASELESS :
3333
f=='m' ? PCRE_MULTILINE :
3434
f=='s' ? PCRE_DOTALL :
3535
f=='x' ? PCRE_EXTENDED :
36-
f=='u' ? PCRE_UTF8 :
3736
error("unknown regex flag: $f")
3837
end
3938
Regex(pattern, options)
4039
end
4140

4241
function show(re::Regex)
43-
if (re.options & ~(PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL|PCRE_EXTENDED))==0
42+
imsx = PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL|PCRE_EXTENDED
43+
if (re.options & ~imsx) == PCRE_UTF8
4444
print('r')
4545
print_quoted_literal(re.pattern)
4646
if (re.options & PCRE_CASELESS ) != 0; print('i'); end

0 commit comments

Comments
 (0)