summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regexec.c1
-rw-r--r--t/run/fresh_perl.t12
2 files changed, 13 insertions, 0 deletions
diff --git a/regexec.c b/regexec.c
index 59111a0069..da451a81a0 100644
--- a/regexec.c
+++ b/regexec.c
@@ -856,6 +856,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
PL_regdata = prog->data;
PL_bostr = startpos;
}
+ S_cache_re(prog);
s = find_byclass(prog, prog->regstclass, s, endpos, startpos, 1);
if (!s) {
#ifdef DEBUGGING
diff --git a/t/run/fresh_perl.t b/t/run/fresh_perl.t
index 9c3e55c4ef..a07396f419 100644
--- a/t/run/fresh_perl.t
+++ b/t/run/fresh_perl.t
@@ -807,3 +807,15 @@ utf8::upgrade($_); # the original code used a UTF-8 locale (affects STDIN)
# is what matters.
/^([[:digit:]]+)/;
EXPECT
+######## [perl #20667] unicode regex vs non-unicode regex
+$toto = 'Hello';
+$toto =~ /\w/; # this line provokes the problem!
+$name = 'A B';
+# utf8::upgrade($name) if @ARGV;
+if ($name =~ /(\p{IsUpper}) (\p{IsUpper})/){
+ print "It's good! >$1< >$2<\n";
+} else {
+ print "It's not good...\n";
+}
+EXPECT
+It's good! >A< >B<