Move the locale/strict/warnings helper files back
[p5sagit/p5-mst-13.2.git] / t / lib / warnings / regcomp
CommitLineData
599cee73 1 regcomp.c AOK
2
f9373011 3 Quantifier unexpected on zero-length expression [S_study_chunk]
4
5 (?p{}) is deprecated - use (??{}) [S_reg]
6 $a =~ /(?p{'x'})/ ;
7
8
9 Useless (%s%c) - %suse /%c modifier [S_reg]
10 Useless (%sc) - %suse /gc modifier [S_reg]
11
12
13
767a6a26 14 Strange *+?{} on zero-length expression [S_study_chunk]
15 /(?=a)?/
599cee73 16
767a6a26 17 %.*s matches null string many times [S_regpiece]
599cee73 18 $a = "ABC123" ; $a =~ /(?=a)*/'
19
ac561586 20 /%.127s/: Unrecognized escape \\%c passed through [S_regatom]
e476b1b5 21 $x = '\m' ; /$x/
599cee73 22
f9373011 23 POSIX syntax [%c %c] is reserved for future extensions [S_checkposixcc]
24
25
ac561586 26 Character class [:%.*s:] unknown [S_regpposixcc]
27
767a6a26 28 Character class syntax [%c %c] belongs inside character classes [S_checkposixcc]
29
73b437c8 30 /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass]
599cee73 31
73b437c8 32 /%.127s/: false [] range \"%*.*s\" in regexp [S_regclassutf8]
599cee73 33
1028017a 34 /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclass]
35
36 /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclassutf8]
37
f9373011 38 False [] range \"%*.*s\" [S_regclass]
39
599cee73 40__END__
767a6a26 41# regcomp.c [S_regpiece]
e476b1b5 42use warnings 'regexp' ;
599cee73 43my $a = "ABC123" ;
44$a =~ /(?=a)*/ ;
e476b1b5 45no warnings 'regexp' ;
0453d815 46$a =~ /(?=a)*/ ;
599cee73 47EXPECT
7253e4e3 48(?=a)* matches null string many times in regex; marked by <-- HERE in m/(?=a)* <-- HERE / at - line 4.
599cee73 49########
767a6a26 50# regcomp.c [S_study_chunk]
e476b1b5 51use warnings 'regexp' ;
599cee73 52$_ = "" ;
53/(?=a)?/;
e476b1b5 54no warnings 'regexp' ;
0453d815 55/(?=a)?/;
599cee73 56EXPECT
7253e4e3 57Quantifier unexpected on zero-length expression in regex; marked by <-- HERE in m/(?=a)? <-- HERE / at - line 4.
599cee73 58########
767a6a26 59# regcomp.c [S_regatom]
e476b1b5 60$x = '\m' ;
61use warnings 'regexp' ;
62$a =~ /a$x/ ;
63no warnings 'regexp' ;
64$a =~ /a$x/ ;
767a6a26 65EXPECT
7253e4e3 66Unrecognized escape \m passed through in regex; marked by <-- HERE in m/a\m <-- HERE / at - line 4.
767a6a26 67########
68# regcomp.c [S_regpposixcc S_checkposixcc]
7f01dc7a 69#
e476b1b5 70use warnings 'regexp' ;
599cee73 71$_ = "" ;
e8c223df 72/[:alpha:]/;
e8c223df 73/[:zog:]/;
ac561586 74/[[:zog:]]/;
e476b1b5 75no warnings 'regexp' ;
e8c223df 76/[:alpha:]/;
ac561586 77/[:zog:]/;
3802429d 78/[[:zog:]]/;
599cee73 79EXPECT
7253e4e3 80POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:alpha:] <-- HERE / at - line 5.
81POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:zog:] <-- HERE / at - line 6.
82POSIX class [:zog:] unknown in regex; marked by <-- HERE in m/[[:zog:] <-- HERE ]/
3802429d 83########
84# regcomp.c [S_checkposixcc]
7f01dc7a 85#
3802429d 86use warnings 'regexp' ;
87$_ = "" ;
88/[.zog.]/;
89no warnings 'regexp' ;
90/[.zog.]/;
91EXPECT
7253e4e3 92POSIX syntax [. .] belongs inside character classes in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5.
93POSIX syntax [. .] is reserved for future extensions in regex; marked by <-- HERE in m/[.zog.] <-- HERE /
3802429d 94########
95# regcomp.c [S_checkposixcc]
7f01dc7a 96#
3802429d 97use warnings 'regexp' ;
98$_ = "" ;
99/[[.zog.]]/;
100no warnings 'regexp' ;
101/[[.zog.]]/;
102EXPECT
7253e4e3 103POSIX syntax [. .] is reserved for future extensions in regex; marked by <-- HERE in m/[[.zog.] <-- HERE ]/
73b437c8 104########
105# regcomp.c [S_regclass]
106$_ = "";
e476b1b5 107use warnings 'regexp' ;
73b437c8 108/[a-b]/;
109/[a-\d]/;
110/[\d-b]/;
111/[\s-\d]/;
112/[\d-\s]/;
113/[a-[:digit:]]/;
114/[[:digit:]-b]/;
115/[[:alpha:]-[:digit:]]/;
116/[[:digit:]-[:alpha:]]/;
e476b1b5 117no warnings 'regexp' ;
73b437c8 118/[a-b]/;
119/[a-\d]/;
120/[\d-b]/;
121/[\s-\d]/;
122/[\d-\s]/;
123/[a-[:digit:]]/;
124/[[:digit:]-b]/;
125/[[:alpha:]-[:digit:]]/;
126/[[:digit:]-[:alpha:]]/;
127EXPECT
7253e4e3 128False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 5.
129False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 6.
130False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 7.
131False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 8.
132False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 9.
133False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 10.
134False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 11.
135False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 12.
73b437c8 136########
137# regcomp.c [S_regclassutf8]
59af8754 138BEGIN {
139 if (ord("\t") == 5) {
140 print "SKIPPED\n# ebcdic regular expression ranges differ.";
141 exit 0;
142 }
143}
73b437c8 144use utf8;
145$_ = "";
e476b1b5 146use warnings 'regexp' ;
73b437c8 147/[a-b]/;
148/[a-\d]/;
149/[\d-b]/;
150/[\s-\d]/;
151/[\d-\s]/;
152/[a-[:digit:]]/;
153/[[:digit:]-b]/;
154/[[:alpha:]-[:digit:]]/;
155/[[:digit:]-[:alpha:]]/;
e476b1b5 156no warnings 'regexp' ;
73b437c8 157/[a-b]/;
158/[a-\d]/;
159/[\d-b]/;
160/[\s-\d]/;
161/[\d-\s]/;
162/[a-[:digit:]]/;
163/[[:digit:]-b]/;
164/[[:alpha:]-[:digit:]]/;
165/[[:digit:]-[:alpha:]]/;
166EXPECT
7253e4e3 167False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 12.
168False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 13.
169False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 14.
170False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 15.
171False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 16.
172False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 17.
173False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 18.
174False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 19.
1028017a 175########
176# regcomp.c [S_regclass S_regclassutf8]
e476b1b5 177use warnings 'regexp' ;
1028017a 178$a =~ /[a\zb]/ ;
e476b1b5 179no warnings 'regexp' ;
1028017a 180$a =~ /[a\zb]/ ;
181EXPECT
7253e4e3 182Unrecognized escape \z in character class passed through in regex; marked by <-- HERE in m/[a\z <-- HERE b]/ at - line 3.
b45f050a 183
f9373011 184########
185# regcomp.c [S_study_chunk]
186use warnings 'deprecated' ;
187$a = "xx" ;
188$a =~ /(?p{'x'})/ ;
189no warnings ;
190use warnings 'regexp' ;
191$a =~ /(?p{'x'})/ ;
192use warnings;
193no warnings 'deprecated' ;
194no warnings 'regexp' ;
195$a =~ /(?p{'x'})/ ;
196EXPECT
197(?p{}) is deprecated - use (??{}) in regex; marked by <-- HERE in m/(?p <-- HERE {'x'})/ at - line 4.
198(?p{}) is deprecated - use (??{}) in regex; marked by <-- HERE in m/(?p <-- HERE {'x'})/ at - line 7.
199########
200# regcomp.c [S_reg]
201use warnings 'regexp' ;
202$a = qr/(?c)/;
203$a = qr/(?-c)/;
204$a = qr/(?g)/;
205$a = qr/(?-g)/;
206$a = qr/(?o)/;
207$a = qr/(?-o)/;
208$a = qr/(?g-o)/;
209$a = qr/(?g-c)/;
210$a = qr/(?o-cg)/; # (?c) means (?g) error won't be thrown
211$a = qr/(?ogc)/;
212no warnings 'regexp' ;
213$a = qr/(?c)/;
214$a = qr/(?-c)/;
215$a = qr/(?g)/;
216$a = qr/(?-g)/;
217$a = qr/(?o)/;
218$a = qr/(?-o)/;
219$a = qr/(?g-o)/;
220$a = qr/(?g-c)/;
221$a = qr/(?o-cg)/; # (?c) means (?g) error won't be thrown
222$a = qr/(?ogc)/;
223#EXPECT
224EXPECT
225Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?c <-- HERE )/ at - line 3.
226Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?-c <-- HERE )/ at - line 4.
227Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE )/ at - line 5.
228Useless (?-g) - don't use /g modifier in regex; marked by <-- HERE in m/(?-g <-- HERE )/ at - line 6.
229Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE )/ at - line 7.
230Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?-o <-- HERE )/ at - line 8.
231Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -o)/ at - line 9.
232Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?g-o <-- HERE )/ at - line 9.
233Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -c)/ at - line 10.
234Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?g-c <-- HERE )/ at - line 10.
235Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE -cg)/ at - line 11.
236Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?o-c <-- HERE g)/ at - line 11.
237Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE gc)/ at - line 12.
238Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?og <-- HERE c)/ at - line 12.
239Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?ogc <-- HERE )/ at - line 12.