summaryrefslogtreecommitdiff
path: root/t/lib
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2010-08-18 23:48:16 -0600
committerFlorian Ragwitz <rafl@debian.org>2010-09-20 08:13:30 +0200
commitfb85c0447bf1d343a9b4d4d7075184aeb4c9ae46 (patch)
tree47c8406e939af312e69568c7a9ced9ec7d3529ed /t/lib
parent5c3fa2e7f75bb4370f758b363cec53992c7fd20a (diff)
downloadperl-fb85c0447bf1d343a9b4d4d7075184aeb4c9ae46.tar.gz
Add (?^...) regex construct
This adds (?^...) to signify to use the default regex modifiers for the cluster or embedded pattern-match modifier change. The major purpose of this is to simplify regex stringification, so that "^" is output in place of "-xism". As a result, the stringification will not change in the future when new regex modifiers are added, so tests, etc. that rely on a particular stringification will have to change now, but never again. Code that needs to work properly with both old- and new-style regexes can use something like the following: # Accept both old and new-style stringification my $modifiers = (qr/foobar/ =~ /\Q(?^/) ? '^' : '-xism'; This construct is Ben Morrow's idea.
Diffstat (limited to 't/lib')
-rw-r--r--t/lib/warnings/regcomp5
1 files changed, 5 insertions, 0 deletions
diff --git a/t/lib/warnings/regcomp b/t/lib/warnings/regcomp
index 98280f61f4..2842882371 100644
--- a/t/lib/warnings/regcomp
+++ b/t/lib/warnings/regcomp
@@ -250,3 +250,8 @@ $a = qr/[\8\9]/;
EXPECT
Unrecognized escape \8 in character class passed through in regex; marked by <-- HERE in m/[\8 <-- HERE \9]/ at - line 3.
Unrecognized escape \9 in character class passed through in regex; marked by <-- HERE in m/[\8\9 <-- HERE ]/ at - line 3.
+########
+# regcomp.c [Perl_re_compile]
+$a = qr/(?^-i:foo)/;
+EXPECT
+Sequence (?^-...) not recognized in regex; marked by <-- HERE in m/(?^- <-- HERE i:foo)/ at - line 2.