summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/t/pragma/warn/regcomp
blob: 5d0c291ea042112954375ae06b3272e86dd7f601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
  regcomp.c	AOK

  Strange *+?{} on zero-length expression	[S_study_chunk]
	/(?=a)?/

  %.*s matches null string many times   	[S_regpiece]
	$a = "ABC123" ; $a =~ /(?=a)*/'

  /%.127s/: Unrecognized escape \\%c passed through	[S_regatom] 
  	$x = '\m' ; /$x/

  Character class [:%.*s:] unknown	[S_regpposixcc]

  Character class syntax [. .] is reserved for future extensions [S_regpposixcc]

  Character class syntax [= =] is reserved for future extensions [S_checkposixcc]

  Character class syntax [%c %c] belongs inside character classes [S_checkposixcc] 
  
  /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass]

  /%.127s/: false [] range \"%*.*s\" in regexp [S_regclassutf8]

  /%.127s/: Unrecognized escape \\%c in character class passed through"	[S_regclass] 

  /%.127s/: Unrecognized escape \\%c in character class passed through"	[S_regclassutf8] 

__END__
# regcomp.c [S_regpiece]
use warnings 'regexp' ;
my $a = "ABC123" ; 
$a =~ /(?=a)*/ ;
no warnings 'regexp' ;
$a =~ /(?=a)*/ ;
EXPECT
(?=a)* matches null string many times at - line 4.
########
# regcomp.c [S_study_chunk]
use warnings 'regexp' ;
$_ = "" ;
/(?=a)?/;
no warnings 'regexp' ;
/(?=a)?/;
EXPECT
Strange *+?{} on zero-length expression at - line 4.
########
# regcomp.c [S_regatom]
$x = '\m' ;
use warnings 'regexp' ;
$a =~ /a$x/ ;
no warnings 'regexp' ;
$a =~ /a$x/ ;
EXPECT
/a\m/: Unrecognized escape \m passed through at - line 4.
########
# regcomp.c [S_regpposixcc S_checkposixcc]
BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 }
use warnings 'regexp' ;
$_ = "" ;
/[:alpha:]/;
/[.bar.]/;
/[=zog=]/;
/[[:alpha:]]/;
/[[.foo.]]/;
/[[=bar=]]/;
/[:zog:]/;
/[[:zog:]]/;
no warnings 'regexp' ;
/[:alpha:]/;
/[.foo.]/;
/[=bar=]/;
/[[:alpha:]]/;
/[[.foo.]]/;
/[[=bar=]]/;
/[[:zog:]]/;
/[:zog:]/;
EXPECT
Character class syntax [: :] belongs inside character classes at - line 5.
Character class syntax [. .] belongs inside character classes at - line 6.
Character class syntax [. .] is reserved for future extensions at - line 6.
Character class syntax [= =] belongs inside character classes at - line 7.
Character class syntax [= =] is reserved for future extensions at - line 7.
Character class syntax [. .] is reserved for future extensions at - line 9.
Character class syntax [= =] is reserved for future extensions at - line 10.
Character class syntax [: :] belongs inside character classes at - line 11.
Character class [:zog:] unknown at - line 12.
########
# regcomp.c [S_regclass]
$_ = "";
use warnings 'regexp' ;
/[a-b]/;
/[a-\d]/;
/[\d-b]/;
/[\s-\d]/;
/[\d-\s]/;
/[a-[:digit:]]/;
/[[:digit:]-b]/;
/[[:alpha:]-[:digit:]]/;
/[[:digit:]-[:alpha:]]/;
no warnings 'regexp' ;
/[a-b]/;
/[a-\d]/;
/[\d-b]/;
/[\s-\d]/;
/[\d-\s]/;
/[a-[:digit:]]/;
/[[:digit:]-b]/;
/[[:alpha:]-[:digit:]]/;
/[[:digit:]-[:alpha:]]/;
EXPECT
/[a-\d]/: false [] range "a-\d" in regexp at - line 5.
/[\d-b]/: false [] range "\d-" in regexp at - line 6.
/[\s-\d]/: false [] range "\s-" in regexp at - line 7.
/[\d-\s]/: false [] range "\d-" in regexp at - line 8.
/[a-[:digit:]]/: false [] range "a-[:digit:]" in regexp at - line 9.
/[[:digit:]-b]/: false [] range "[:digit:]-" in regexp at - line 10.
/[[:alpha:]-[:digit:]]/: false [] range "[:alpha:]-" in regexp at - line 11.
/[[:digit:]-[:alpha:]]/: false [] range "[:digit:]-" in regexp at - line 12.
########
# regcomp.c [S_regclassutf8]
BEGIN {
    if (ord("\t") == 5) {
        print "SKIPPED\n# ebcdic regular expression ranges differ.";
        exit 0;
    }
}
use utf8;
$_ = "";
use warnings 'regexp' ;
/[a-b]/;
/[a-\d]/;
/[\d-b]/;
/[\s-\d]/;
/[\d-\s]/;
/[a-[:digit:]]/;
/[[:digit:]-b]/;
/[[:alpha:]-[:digit:]]/;
/[[:digit:]-[:alpha:]]/;
no warnings 'regexp' ;
/[a-b]/;
/[a-\d]/;
/[\d-b]/;
/[\s-\d]/;
/[\d-\s]/;
/[a-[:digit:]]/;
/[[:digit:]-b]/;
/[[:alpha:]-[:digit:]]/;
/[[:digit:]-[:alpha:]]/;
EXPECT
/[a-\d]/: false [] range "a-\d" in regexp at - line 12.
/[\d-b]/: false [] range "\d-" in regexp at - line 13.
/[\s-\d]/: false [] range "\s-" in regexp at - line 14.
/[\d-\s]/: false [] range "\d-" in regexp at - line 15.
/[a-[:digit:]]/: false [] range "a-[:digit:]" in regexp at - line 16.
/[[:digit:]-b]/: false [] range "[:digit:]-" in regexp at - line 17.
/[[:alpha:]-[:digit:]]/: false [] range "[:alpha:]-" in regexp at - line 18.
/[[:digit:]-[:alpha:]]/: false [] range "[:digit:]-" in regexp at - line 19.
########
# regcomp.c [S_regclass S_regclassutf8]
use warnings 'regexp' ;
$a =~ /[a\zb]/ ;
no warnings 'regexp' ;
$a =~ /[a\zb]/ ;
EXPECT
/[a\zb]/: Unrecognized escape \z in character class passed through at - line 3.
OpenPOWER on IntegriCloud