#!/usr/bin/perl
$_ = "-g_r0a_d";
if (/^\w+/) {
print "a full word matched.\n";
} else {
print "not match a word.\n";
}
$_ = "g_r0a_d";
if (/^\w+/) {
print "a full word matched.\n";
} else {
print "not match a word.\n";
}
# ./wmatch.pl
not match a word.
a full word matched.
#!/usr/bin/perl
$_ = "wonderful";
if (/\bwon/) {
print "match\n";
} else {
print "not match\n";
}
$_ = "wonder";
if (/\bwon/) {
print "match\n";
} else {
print "not match\n";
}
$_ = "wonderful";
if (/\bwoner\b/) {
print "match\n";
} else {
print "not match\n";
}
$_ = "wonderful";
if (/\bwonderful\b/) {
print "match\n";
} else {
print "not match\n";
}
# ./bmatch.pl
match
match
not match
match
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |