- 论坛徽章:
- 145
|
回复 1# congkk
equal and not equal ( == and !=)
match and not match ( =~ and !~)
$ perldoc perlretut
NAME
perlretut - Perl regular expressions tutorial
DESCRIPTION
This page provides a basic tutorial on understanding, creating and
using regular expressions in Perl. It serves as a complement to the
reference page on regular expressions perlre. Regular expressions are
an integral part of the "m//", "s///", "qr//" and "split" operators and
so this tutorial also overlaps with "Regexp Quote-Like Operators" in
perlop and "split" in perlfunc.
...
...
if ("Hello World" =~ /World/) {
print "It matches\n";
}
else {
print "It doesn't match\n";
}
There are useful variations on this theme. The sense of the match can
be reversed by using the "!~" operator:
if ("Hello World" !~ /World/) {
print "It doesn't match\n";
}
else {
print "It matches\n";
}
|
|