1 regcomp.c AOK 2 3 Quantifier unexpected on zero-length expression [S_study_chunk] 4 5 Useless (%s%c) - %suse /%c modifier [S_reg] 6 Useless (%sc) - %suse /gc modifier [S_reg] 7 8 9 10 Strange *+?{} on zero-length expression [S_study_chunk] 11 /(?=a)?/ 12 13 %.*s matches null string many times [S_regpiece] 14 $a = "ABC123" ; $a =~ /(?=a)*/' 15 16 /%.127s/: Unrecognized escape \\%c passed through [S_regatom] 17 $x = '\m' ; /$x/ 18 19 POSIX syntax [%c %c] belongs inside character classes [S_checkposixcc] 20 21 22 Character class [:%.*s:] unknown [S_regpposixcc] 23 24 Character class syntax [%c %c] belongs inside character classes [S_checkposixcc] 25 26 /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass] 27 28 /%.127s/: false [] range \"%*.*s\" in regexp [S_regclassutf8] 29 30 /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclass] 31 32 /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclassutf8] 33 34 False [] range \"%*.*s\" [S_regclass] 35 36__END__ 37# regcomp.c [S_regpiece] 38use warnings 'regexp' ; 39my $a = "ABC123" ; 40$a =~ /(?=a)*/ ; 41no warnings 'regexp' ; 42$a =~ /(?=a)*/ ; 43EXPECT 44(?=a)* matches null string many times in regex; marked by <-- HERE in m/(?=a)* <-- HERE / at - line 4. 45######## 46# regcomp.c [S_regatom] 47$x = '\m' ; 48use warnings 'regexp' ; 49$a =~ /a$x/ ; 50no warnings 'regexp' ; 51$a =~ /a$x/ ; 52EXPECT 53Unrecognized escape \m passed through in regex; marked by <-- HERE in m/a\m <-- HERE / at - line 4. 54######## 55# regcomp.c [S_regatom] 56# The \q should warn, the \_ should NOT warn. 57use warnings 'regexp'; 58"foo" =~ /\q/; 59"foo" =~ /\q{/; 60"foo" =~ /a\b{cde/; 61"foo" =~ /a\B{cde/; 62"bar" =~ /\_/; 63no warnings 'regexp'; 64"foo" =~ /\q/; 65"foo" =~ /\q{/; 66"foo" =~ /a\b{cde/; 67"foo" =~ /a\B{cde/; 68"bar" =~ /\_/; 69EXPECT 70Unrecognized escape \q passed through in regex; marked by <-- HERE in m/\q <-- HERE / at - line 4. 71Unrecognized escape \q{ passed through in regex; marked by <-- HERE in m/\q{ <-- HERE / at - line 5. 72"\b{" is deprecated; use "\b\{" instead in regex; marked by <-- HERE in m/a\ <-- HERE b{cde/ at - line 6. 73"\B{" is deprecated; use "\B\{" instead in regex; marked by <-- HERE in m/a\ <-- HERE B{cde/ at - line 7. 74######## 75# regcomp.c [S_regpposixcc S_checkposixcc] 76# 77use warnings 'regexp' ; 78$_ = "" ; 79/[:alpha:]/; 80/[:zog:]/; 81no warnings 'regexp' ; 82/[:alpha:]/; 83/[:zog:]/; 84EXPECT 85POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:alpha:] <-- HERE / at - line 5. 86POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:zog:] <-- HERE / at - line 6. 87######## 88# regcomp.c [S_checkposixcc] 89# 90use warnings 'regexp' ; 91$_ = "" ; 92/[.zog.]/; 93no warnings 'regexp' ; 94/[.zog.]/; 95EXPECT 96POSIX syntax [. .] belongs inside character classes in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5. 97POSIX syntax [. .] is reserved for future extensions in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5. 98######## 99# regcomp.c [S_regclass] 100$_ = ""; 101use warnings 'regexp' ; 102/[a-b]/; 103/[a-\d]/; 104/[\d-b]/; 105/[\s-\d]/; 106/[\d-\s]/; 107/[a-[:digit:]]/; 108/[[:digit:]-b]/; 109/[[:alpha:]-[:digit:]]/; 110/[[:digit:]-[:alpha:]]/; 111no warnings 'regexp' ; 112/[a-b]/; 113/[a-\d]/; 114/[\d-b]/; 115/[\s-\d]/; 116/[\d-\s]/; 117/[a-[:digit:]]/; 118/[[:digit:]-b]/; 119/[[:alpha:]-[:digit:]]/; 120/[[:digit:]-[:alpha:]]/; 121EXPECT 122False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 5. 123False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 6. 124False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 7. 125False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 8. 126False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 9. 127False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 10. 128False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 11. 129False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 12. 130######## 131# regcomp.c [S_regclassutf8] 132BEGIN { 133 if (ord("\t") == 5) { 134 print "SKIPPED\n# ebcdic regular expression ranges differ."; 135 exit 0; 136 } 137} 138use utf8; 139$_ = ""; 140use warnings 'regexp' ; 141/[a-b]/; 142/[a-\d]/; 143/[\d-b]/; 144/[\s-\d]/; 145/[\d-\s]/; 146/[a-[:digit:]]/; 147/[[:digit:]-b]/; 148/[[:alpha:]-[:digit:]]/; 149/[[:digit:]-[:alpha:]]/; 150no warnings 'regexp' ; 151/[a-b]/; 152/[a-\d]/; 153/[\d-b]/; 154/[\s-\d]/; 155/[\d-\s]/; 156/[a-[:digit:]]/; 157/[[:digit:]-b]/; 158/[[:alpha:]-[:digit:]]/; 159/[[:digit:]-[:alpha:]]/; 160EXPECT 161False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 12. 162False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 13. 163False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 14. 164False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 15. 165False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 16. 166False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 17. 167False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 18. 168False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 19. 169######## 170# regcomp.c [S_regclass S_regclassutf8] 171use warnings 'regexp' ; 172$a =~ /[a\zb]/ ; 173no warnings 'regexp' ; 174$a =~ /[a\zb]/ ; 175EXPECT 176Unrecognized escape \z in character class passed through in regex; marked by <-- HERE in m/[a\z <-- HERE b]/ at - line 3. 177 178######## 179# regcomp.c [S_reg] 180use warnings 'regexp' ; 181$a = qr/(?c)/; 182$a = qr/(?-c)/; 183$a = qr/(?g)/; 184$a = qr/(?-g)/; 185$a = qr/(?o)/; 186$a = qr/(?-o)/; 187$a = qr/(?g-o)/; 188$a = qr/(?g-c)/; 189$a = qr/(?o-cg)/; # (?c) means (?g) error won't be thrown 190$a = qr/(?ogc)/; 191no warnings 'regexp' ; 192$a = qr/(?c)/; 193$a = qr/(?-c)/; 194$a = qr/(?g)/; 195$a = qr/(?-g)/; 196$a = qr/(?o)/; 197$a = qr/(?-o)/; 198$a = qr/(?g-o)/; 199$a = qr/(?g-c)/; 200$a = qr/(?o-cg)/; # (?c) means (?g) error won't be thrown 201$a = qr/(?ogc)/; 202#EXPECT 203EXPECT 204Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?c <-- HERE )/ at - line 3. 205Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?-c <-- HERE )/ at - line 4. 206Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE )/ at - line 5. 207Useless (?-g) - don't use /g modifier in regex; marked by <-- HERE in m/(?-g <-- HERE )/ at - line 6. 208Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE )/ at - line 7. 209Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?-o <-- HERE )/ at - line 8. 210Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -o)/ at - line 9. 211Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?g-o <-- HERE )/ at - line 9. 212Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -c)/ at - line 10. 213Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?g-c <-- HERE )/ at - line 10. 214Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE -cg)/ at - line 11. 215Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?o-c <-- HERE g)/ at - line 11. 216Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE gc)/ at - line 12. 217Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?og <-- HERE c)/ at - line 12. 218Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?ogc <-- HERE )/ at - line 12. 219######## 220# regcomp.c [S_regatom] 221$a = qr/\o{/; 222EXPECT 223Missing right brace on \o{ in regex; marked by <-- HERE in m/\o{ <-- HERE / at - line 2. 224######## 225# regcomp.c [S_regatom] 226$a = qr/\o/; 227EXPECT 228Missing braces on \o{} in regex; marked by <-- HERE in m/\o <-- HERE / at - line 2. 229######## 230# regcomp.c [S_regatom] 231$a = qr/\o{}/; 232EXPECT 233Number with no digits in regex; marked by <-- HERE in m/\o{} <-- HERE / at - line 2. 234######## 235# regcomp.c [S_regclass] 236$a = qr/[\o{]/; 237EXPECT 238Missing right brace on \o{ in regex; marked by <-- HERE in m/[\o{ <-- HERE ]/ at - line 2. 239######## 240# regcomp.c [S_regclass] 241$a = qr/[\o]/; 242EXPECT 243Missing braces on \o{} in regex; marked by <-- HERE in m/[\o <-- HERE ]/ at - line 2. 244######## 245# regcomp.c [S_regclass] 246$a = qr/[\o{}]/; 247EXPECT 248Number with no digits in regex; marked by <-- HERE in m/[\o{} <-- HERE ]/ at - line 2. 249######## 250# regcomp.c [S_regclass] 251use warnings 'regexp' ; 252$a = qr/[\8\9]/; 253$a = qr/[\_\0]/; # Should have no warnings on this and the remainder of this test 254$a = qr/[\07]/; 255$a = qr/[\006]/; 256$a = qr/[\0005]/; 257no warnings 'regexp' ; 258$a = qr/[\8\9]/; 259EXPECT 260Unrecognized escape \8 in character class passed through in regex; marked by <-- HERE in m/[\8 <-- HERE \9]/ at - line 3. 261Unrecognized escape \9 in character class passed through in regex; marked by <-- HERE in m/[\8\9 <-- HERE ]/ at - line 3. 262######## 263# regcomp.c [Perl_re_compile] 264$a = qr/(?^-i:foo)/; 265EXPECT 266Sequence (?^-...) not recognized in regex; marked by <-- HERE in m/(?^- <-- HERE i:foo)/ at - line 2. 267