New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] regex with \p{IsAlpha} doesn't match properly #9720
Comments
From @ntyniAs reported by Srdjan <srdjan@catalyst.net.nz> in "abcd" =~ /x*\p{IsAlpha}/ while this supposedly equivalent match succeeds: "abcd" =~ /x*[[:alpha:]]/ Reported at 5.8.2, verified with 5.8.8, 5.10.0 and current blead. Output with -Dr: Compiling REx "x*\p{IsAlpha}" It seems that the problem has to do with losing the UNICODE_ALL flag Perl Info
|
From @ntyni0001-Add-TODO-test-for-x-p-IsAlpha-match-failure.patchFrom bf52a1792a253b8bfd58b82d5b56581b2d6be397 Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Thu, 23 Apr 2009 00:00:27 +0300
Subject: [PATCH] Add TODO test for /x*\p{IsAlpha}/ match failure
As reported by Srdjan <srdjan@catalyst.net.nz> in
<http://bugs.debian.org/230144>, this match currently
fails:
"abcd" =~ /x*\p{IsAlpha}/
while this supposedly equivalent match succeeds:
"abcd" =~ /x*[[:alpha:]]/
---
t/uni/class.t | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/t/uni/class.t b/t/uni/class.t
index 4620ca0..b755aae 100644
--- a/t/uni/class.t
+++ b/t/uni/class.t
@@ -4,7 +4,7 @@ BEGIN {
require "test.pl";
}
-plan tests => 5092;
+plan tests => 5094;
sub MyUniClass {
<<END;
@@ -71,6 +71,13 @@ is(($str =~ /(\p{Other::Class}+)/)[0], '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_');
# make sure it finds class in other OTHER package
is(($str =~ /(\p{A::B::Intersection}+)/)[0], '@ABCDEFGHIJKLMNO');
+# see http://bugs.debian.org/230144
+{
+is(($str =~ /x*([[:alpha:]])/)[0], 'A');
+local $::TODO = "currently `contradicts stdclass'";
+is(($str =~ /x*(\p{IsAlpha})/)[0], 'A');
+}
+
# all of these should look in lib/unicore/bc/AL.pl
$str = "\x{070D}\x{070E}\x{070F}\x{0710}\x{0711}";
is(($str =~ /(\P{BidiClass: ArabicLetter}+)/)[0], "\x{070E}\x{070F}");
--
1.5.6.5
|
From @ntyni0002-Fix-x-p-IsAlpha-match-failure.patchFrom 33c4880b1d1e03d0b33adf341c6f93f9387f51ba Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Thu, 23 Apr 2009 00:03:52 +0300
Subject: [PATCH] Fix /x*\p{IsAlpha}/ match failure
regexec_flags() says 'Contradicts stclass...' because
the ANYOF_UNICODE flag is lost while cl_and()ing
the classes.
---
regcomp.c | 2 +-
t/uni/class.t | 3 ---
2 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/regcomp.c b/regcomp.c
index e061528..150e7d0 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -3665,7 +3665,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
}
if (flags & SCF_DO_STCLASS_OR)
- cl_and(data->start_class, and_withp);
+ cl_or(pRExC_state, data->start_class, and_withp);
flags &= ~SCF_DO_STCLASS;
}
}
diff --git a/t/uni/class.t b/t/uni/class.t
index b755aae..3acaf76 100644
--- a/t/uni/class.t
+++ b/t/uni/class.t
@@ -72,11 +72,8 @@ is(($str =~ /(\p{Other::Class}+)/)[0], '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_');
is(($str =~ /(\p{A::B::Intersection}+)/)[0], '@ABCDEFGHIJKLMNO');
# see http://bugs.debian.org/230144
-{
is(($str =~ /x*([[:alpha:]])/)[0], 'A');
-local $::TODO = "currently `contradicts stdclass'";
is(($str =~ /x*(\p{IsAlpha})/)[0], 'A');
-}
# all of these should look in lib/unicore/bc/AL.pl
$str = "\x{070D}\x{070E}\x{070F}\x{0710}\x{0711}";
--
1.5.6.5
|
jarich@perltraining.com.au - Status changed from 'new' to 'open' |
From @khwilliamsonThis was fixed in 5.13.11 |
@khwilliamson - Status changed from 'open' to 'resolved' |
From @khwilliamsonThis was fixed in 5.13.11 |
Migrated from rt.perl.org#65054 (status was 'resolved')
Searchable as RT65054$
The text was updated successfully, but these errors were encountered: