Check for a or b : Pattern matching « Regular Expression « Perl
- Perl
- Regular Expression
- Pattern matching
Check for a or b
#!/usr/bin/perl -w
foreach $patt (@ARGV) {
# Check for a or b.
if ($patt =~ /a|b/) {
print "\tFound an a or b in \"$patt\".\n";
}
}
Related examples in the same category