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