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"bar" =~ /\_/; 60no warnings 'regexp'; 61"foo" =~ /\q/; 62"bar" =~ /\_/; 63EXPECT 64Unrecognized escape \q passed through in regex; marked by <-- HERE in m/\q <-- HERE / at - line 4. 65######## 66# regcomp.c [S_regpposixcc S_checkposixcc] 67# 68use warnings 'regexp' ; 69$_ = "" ; 70/[:alpha:]/; 71/[:zog:]/; 72no warnings 'regexp' ; 73/[:alpha:]/; 74/[:zog:]/; 75EXPECT 76POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:alpha:] <-- HERE / at - line 5. 77POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:zog:] <-- HERE / at - line 6. 78######## 79# regcomp.c [S_checkposixcc] 80# 81use warnings 'regexp' ; 82$_ = "" ; 83/[.zog.]/; 84no warnings 'regexp' ; 85/[.zog.]/; 86EXPECT 87POSIX syntax [. .] belongs inside character classes in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5. 88POSIX syntax [. .] is reserved for future extensions in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5. 89######## 90# regcomp.c [S_regclass] 91$_ = ""; 92use warnings 'regexp' ; 93/[a-b]/; 94/[a-\d]/; 95/[\d-b]/; 96/[\s-\d]/; 97/[\d-\s]/; 98/[a-[:digit:]]/; 99/[[:digit:]-b]/; 100/[[:alpha:]-[:digit:]]/; 101/[[:digit:]-[:alpha:]]/; 102no warnings 'regexp' ; 103/[a-b]/; 104/[a-\d]/; 105/[\d-b]/; 106/[\s-\d]/; 107/[\d-\s]/; 108/[a-[:digit:]]/; 109/[[:digit:]-b]/; 110/[[:alpha:]-[:digit:]]/; 111/[[:digit:]-[:alpha:]]/; 112EXPECT 113False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 5. 114False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 6. 115False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 7. 116False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 8. 117False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 9. 118False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 10. 119False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 11. 120False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 12. 121######## 122# regcomp.c [S_regclassutf8] 123BEGIN { 124 if (ord("\t") == 5) { 125 print "SKIPPED\n# ebcdic regular expression ranges differ."; 126 exit 0; 127 } 128} 129use utf8; 130$_ = ""; 131use warnings 'regexp' ; 132/[a-b]/; 133/[a-\d]/; 134/[\d-b]/; 135/[\s-\d]/; 136/[\d-\s]/; 137/[a-[:digit:]]/; 138/[[:digit:]-b]/; 139/[[:alpha:]-[:digit:]]/; 140/[[:digit:]-[:alpha:]]/; 141no warnings 'regexp' ; 142/[a-b]/; 143/[a-\d]/; 144/[\d-b]/; 145/[\s-\d]/; 146/[\d-\s]/; 147/[a-[:digit:]]/; 148/[[:digit:]-b]/; 149/[[:alpha:]-[:digit:]]/; 150/[[:digit:]-[:alpha:]]/; 151EXPECT 152False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 12. 153False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 13. 154False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 14. 155False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 15. 156False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 16. 157False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 17. 158False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 18. 159False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 19. 160######## 161# regcomp.c [S_regclass S_regclassutf8] 162use warnings 'regexp' ; 163$a =~ /[a\zb]/ ; 164no warnings 'regexp' ; 165$a =~ /[a\zb]/ ; 166EXPECT 167Unrecognized escape \z in character class passed through in regex; marked by <-- HERE in m/[a\z <-- HERE b]/ at - line 3. 168 169######## 170# regcomp.c [S_reg] 171use warnings 'regexp' ; 172$a = qr/(?c)/; 173$a = qr/(?-c)/; 174$a = qr/(?g)/; 175$a = qr/(?-g)/; 176$a = qr/(?o)/; 177$a = qr/(?-o)/; 178$a = qr/(?g-o)/; 179$a = qr/(?g-c)/; 180$a = qr/(?o-cg)/; # (?c) means (?g) error won't be thrown 181$a = qr/(?ogc)/; 182no warnings 'regexp' ; 183$a = qr/(?c)/; 184$a = qr/(?-c)/; 185$a = qr/(?g)/; 186$a = qr/(?-g)/; 187$a = qr/(?o)/; 188$a = qr/(?-o)/; 189$a = qr/(?g-o)/; 190$a = qr/(?g-c)/; 191$a = qr/(?o-cg)/; # (?c) means (?g) error won't be thrown 192$a = qr/(?ogc)/; 193#EXPECT 194EXPECT 195Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?c <-- HERE )/ at - line 3. 196Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?-c <-- HERE )/ at - line 4. 197Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE )/ at - line 5. 198Useless (?-g) - don't use /g modifier in regex; marked by <-- HERE in m/(?-g <-- HERE )/ at - line 6. 199Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE )/ at - line 7. 200Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?-o <-- HERE )/ at - line 8. 201Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -o)/ at - line 9. 202Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?g-o <-- HERE )/ at - line 9. 203Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -c)/ at - line 10. 204Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?g-c <-- HERE )/ at - line 10. 205Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE -cg)/ at - line 11. 206Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?o-c <-- HERE g)/ at - line 11. 207Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE gc)/ at - line 12. 208Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?og <-- HERE c)/ at - line 12. 209Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?ogc <-- HERE )/ at - line 12. 210