This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
integrate utfperl contents into mainline
[perl5.git] / t / pragma / warn / regcomp
CommitLineData
599cee73
PM
1 regcomp.c AOK
2
767a6a26
PM
3 Strange *+?{} on zero-length expression [S_study_chunk]
4 /(?=a)?/
599cee73 5
767a6a26 6 %.*s matches null string many times [S_regpiece]
599cee73
PM
7 $a = "ABC123" ; $a =~ /(?=a)*/'
8
767a6a26
PM
9 /%.127s/: Unrecognized escape \\%c passed through" [S_regatom]
10 /\m/
599cee73 11
767a6a26
PM
12 Character class syntax [. .] is reserved for future extensions [S_regpposixcc]
13
14 Character class syntax [= =] is reserved for future extensions [S_checkposixcc]
15
16 Character class syntax [%c %c] belongs inside character classes [S_checkposixcc]
17
73b437c8 18 /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass]
599cee73 19
73b437c8 20 /%.127s/: false [] range \"%*.*s\" in regexp [S_regclassutf8]
599cee73 21
1028017a
JH
22 /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclass]
23
24 /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclassutf8]
25
599cee73 26__END__
767a6a26 27# regcomp.c [S_regpiece]
4438c4b7 28use warnings 'unsafe' ;
599cee73
PM
29my $a = "ABC123" ;
30$a =~ /(?=a)*/ ;
4438c4b7 31no warnings 'unsafe' ;
0453d815 32$a =~ /(?=a)*/ ;
599cee73
PM
33EXPECT
34(?=a)* matches null string many times at - line 4.
35########
767a6a26 36# regcomp.c [S_study_chunk]
4438c4b7 37use warnings 'unsafe' ;
599cee73
PM
38$_ = "" ;
39/(?=a)?/;
4438c4b7 40no warnings 'unsafe' ;
0453d815 41/(?=a)?/;
599cee73
PM
42EXPECT
43Strange *+?{} on zero-length expression at - line 4.
44########
767a6a26
PM
45# regcomp.c [S_regatom]
46use warnings 'unsafe' ;
1028017a 47$a =~ /a\mb\b/ ;
767a6a26 48no warnings 'unsafe' ;
1028017a 49$a =~ /a\mb\b/ ;
767a6a26
PM
50EXPECT
51Unrecognized escape \m passed through at - line 3.
52########
53# regcomp.c [S_regpposixcc S_checkposixcc]
4438c4b7 54use warnings 'unsafe' ;
599cee73 55$_ = "" ;
e8c223df 56/[:alpha:]/;
b8c5462f
JH
57/[.bar.]/;
58/[=zog=]/;
e8c223df
JH
59/[[:alpha:]]/;
60/[[.foo.]]/;
61/[[=bar=]]/;
62/[:zog:]/;
4438c4b7 63no warnings 'unsafe' ;
e8c223df
JH
64/[:alpha:]/;
65/[.foo.]/;
66/[=bar=]/;
67/[[:alpha:]]/;
68/[[.foo.]]/;
69/[[=bar=]]/;
70/[:zog:]/;
17d0df5d 71BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 }
e8c223df 72/[[:zog:]]/;
599cee73 73EXPECT
b8c5462f
JH
74Character class syntax [: :] belongs inside character classes at - line 4.
75Character class syntax [. .] belongs inside character classes at - line 5.
76Character class syntax [. .] is reserved for future extensions at - line 5.
77Character class syntax [= =] belongs inside character classes at - line 6.
78Character class syntax [= =] is reserved for future extensions at - line 6.
e8c223df
JH
79Character class syntax [. .] is reserved for future extensions at - line 8.
80Character class syntax [= =] is reserved for future extensions at - line 9.
81Character class syntax [: :] belongs inside character classes at - line 10.
17d0df5d 82Character class [:zog:] unknown at - line 20.
73b437c8
JH
83########
84# regcomp.c [S_regclass]
85$_ = "";
86use warnings 'unsafe' ;
87/[a-b]/;
88/[a-\d]/;
89/[\d-b]/;
90/[\s-\d]/;
91/[\d-\s]/;
92/[a-[:digit:]]/;
93/[[:digit:]-b]/;
94/[[:alpha:]-[:digit:]]/;
95/[[:digit:]-[:alpha:]]/;
96no warnings 'unsafe' ;
97/[a-b]/;
98/[a-\d]/;
99/[\d-b]/;
100/[\s-\d]/;
101/[\d-\s]/;
102/[a-[:digit:]]/;
103/[[:digit:]-b]/;
104/[[:alpha:]-[:digit:]]/;
105/[[:digit:]-[:alpha:]]/;
106EXPECT
107/[a-\d]/: false [] range "a-\d" in regexp at - line 5.
108/[\d-b]/: false [] range "\d-" in regexp at - line 6.
109/[\s-\d]/: false [] range "\s-" in regexp at - line 7.
110/[\d-\s]/: false [] range "\d-" in regexp at - line 8.
111/[a-[:digit:]]/: false [] range "a-[:digit:]" in regexp at - line 9.
112/[[:digit:]-b]/: false [] range "[:digit:]-" in regexp at - line 10.
113/[[:alpha:]-[:digit:]]/: false [] range "[:alpha:]-" in regexp at - line 11.
114/[[:digit:]-[:alpha:]]/: false [] range "[:digit:]-" in regexp at - line 12.
115########
116# regcomp.c [S_regclassutf8]
59af8754
GS
117BEGIN {
118 if (ord("\t") == 5) {
119 print "SKIPPED\n# ebcdic regular expression ranges differ.";
120 exit 0;
121 }
122}
73b437c8
JH
123use utf8;
124$_ = "";
125use warnings 'unsafe' ;
126/[a-b]/;
127/[a-\d]/;
128/[\d-b]/;
129/[\s-\d]/;
130/[\d-\s]/;
131/[a-[:digit:]]/;
132/[[:digit:]-b]/;
133/[[:alpha:]-[:digit:]]/;
134/[[:digit:]-[:alpha:]]/;
135no warnings 'unsafe' ;
136/[a-b]/;
137/[a-\d]/;
138/[\d-b]/;
139/[\s-\d]/;
140/[\d-\s]/;
141/[a-[:digit:]]/;
142/[[:digit:]-b]/;
143/[[:alpha:]-[:digit:]]/;
144/[[:digit:]-[:alpha:]]/;
145EXPECT
146/[a-\d]/: false [] range "a-\d" in regexp at - line 6.
147/[\d-b]/: false [] range "\d-" in regexp at - line 7.
148/[\s-\d]/: false [] range "\s-" in regexp at - line 8.
149/[\d-\s]/: false [] range "\d-" in regexp at - line 9.
150/[a-[:digit:]]/: false [] range "a-[:digit:]" in regexp at - line 10.
151/[[:digit:]-b]/: false [] range "[:digit:]-" in regexp at - line 11.
152/[[:alpha:]-[:digit:]]/: false [] range "[:alpha:]-" in regexp at - line 12.
153/[[:digit:]-[:alpha:]]/: false [] range "[:digit:]-" in regexp at - line 13.
1028017a
JH
154########
155# regcomp.c [S_regclass S_regclassutf8]
156use warnings 'unsafe' ;
157$a =~ /[a\zb]/ ;
158no warnings 'unsafe' ;
159$a =~ /[a\zb]/ ;
160EXPECT
161/[a\zb]/: Unrecognized escape \z in character class passed through at - line 3.