Skip to content

Commit 367e634

Browse files
committed
perlrebackslash: Fix false statements
Prior to this commit, it was claimed that certain sequences should not occur in regular expression pattern bracketed character classes. I tried each one changed here, and they worked fine.
1 parent 52427ad commit 367e634

File tree

2 files changed

+42
-7
lines changed

2 files changed

+42
-7
lines changed

pod/perlrebackslash.pod

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,33 +72,35 @@ as C<Not in [].>
7272
\d Match any digit character.
7373
\D Match any character that isn't a digit.
7474
\e Escape character.
75-
\E Turn off \Q, \L and \U processing. Not in [].
75+
\E Turn off \Q, \L and \U processing. Not in [] unless
76+
is terminating one of those also in the [].
7677
\f Form feed.
77-
\F Foldcase till \E. Not in [].
78+
\F Foldcase till \E.
7879
\g{}, \g1 Named, absolute or relative backreference.
7980
Not in [].
8081
\G Pos assertion. Not in [].
8182
\h Match any horizontal whitespace character.
8283
\H Match any character that isn't horizontal whitespace.
8384
\k{}, \k<>, \k'' Named backreference. Not in [].
8485
\K Keep the stuff left of \K. Not in [].
85-
\l Lowercase next character. Not in [].
86-
\L Lowercase till \E. Not in [].
86+
\l Lowercase next character.
87+
\L Lowercase till \E.
8788
\n (Logical) newline character.
8889
\N Match any character but newline. Not in [].
8990
\N{} Named or numbered (Unicode) character or sequence.
9091
\o{} Octal escape sequence.
9192
\p{}, \pP Match any character with the given Unicode property.
9293
\P{}, \PP Match any character without the given property.
9394
\Q Quote (disable) pattern metacharacters till \E.
94-
(Also called "escape".) Not in [].
95+
(Also called "escape".) Not in [] unless there's a
96+
terminating \E before the ']';
9597
\r Return character.
9698
\R Generic new line. Not in [].
9799
\s Match any whitespace character.
98100
\S Match any character that isn't a whitespace.
99101
\t Tab character.
100-
\u Titlecase next character. Not in [].
101-
\U Uppercase till \E. Not in [].
102+
\u Titlecase next character.
103+
\U Uppercase till \E.
102104
\v Match any vertical whitespace character.
103105
\V Match any character that isn't vertical whitespace
104106
\w Match any word character.

t/re/re_tests

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,6 +2172,39 @@ ABCF|BCDE|C(G) ABCDE y $& BCDE - # GH 22892 - AHO-CORASICK bug
21722172
ABCF|BCDE|C[Gg] ABCDE y $& BCDE - # GH 22892 - AHO-CORASICK bug
21732173
ABCF|BCD[Ee]|C[Gg] ABCDE y $& BCDE - # GH 22892 - AHO-CORASICK bug
21742174

2175+
# The next few tests are of constructs thought not to work in []. But they
2176+
# (perhaps accidentally) do, and were documented as such in GH 23688. The ones
2177+
# that failed regex_sets_compat.t were marked to skip there, without any
2178+
# investigation. Presumably its a result of limitations in the code that
2179+
# translates these to set notation, and isn't worth fixing.
2180+
/[\lAB]c/ ac yS $& ac - \l works in []
2181+
/[\lAB]c/ Bc y $& Bc - \l works in []
2182+
2183+
/[\uab]c/ Ac yS $& Ac - \u works in []
2184+
/[\uab]c/ bc y $& bc - \u works in []
2185+
2186+
/[\LA\EB]c/ ac y $& ac - \L...\E works in []
2187+
/[\LA\EB]c/ Bc y $& Bc - \L...\E works in []
2188+
2189+
/[\Ua\EB]c/ Ac y $& Ac - \L...\E works in []
2190+
/[\Ua\EB]c/ Bc y $& Bc - \L...\E works in []
2191+
2192+
/[\FA\EB]c/ ac y $& ac - \L...\E works in []
2193+
/[\FA\EB]c/ Bc y $& Bc - \L...\E works in []
2194+
2195+
/[a\Q]\E]c/ ac yS $& ac - \Q...\E works in []
2196+
/[a\Q]\E]c/ ]c yS $& ]c - \Q...\E works in []
2197+
2198+
/[a\Q]]\Ec/ ]c cS - Unmatched [ - \Q...\E can't straddle []
2199+
/[\LA]B\Ec/ abc y $& abc - Straddling [ \L ] \E works
2200+
/[\FA]B\Ec/ abc y $& abc - Straddling [ \F ] \E works
2201+
/[\Ua]B\Ec/ ABc y $& ABc - Straddling [ \U ] \E works
2202+
2203+
/[A\EB]c/ Bc c - Useless use of \\E - \E in [] needs prior \[FLUQ]
2204+
/\L[A]B\Ec/ abc y $& abc - Straddling \L [ \E ] works
2205+
/\F[A]B\Ec/ abc y $& abc - Straddling \F [ \E ] works
2206+
/\U[a]B\Ec/ ABc y $& ABc - Straddling \U [ \E ] works
2207+
21752208
# Keep these lines at the end of the file
21762209
# pat string y/n/etc expr expected-expr skip-reason comment
21772210
# vim: softtabstop=0 noexpandtab

0 commit comments

Comments
 (0)