regular expression matching
Curtis Poe
cp at onsitetech.com
Wed Jun 5 16:23:15 CDT 2002
$service="cns-noc_server1";
$rule="cns-noc";
if( $service =~ /\Q$rule\E/ ){
print "$rule is in $service \n";
} else {
print "$rule isn't in $service \n";
}
\Q and \E help to ensure that the text is interpreted literally (i.e.,
characters with special meaning to a regex are treated literally. Read
'perldoc perlre' for more information about pitfalls using \Q and \E.
--
Cheers,
Curtis Poe
Senior Programmer
ONSITE! Technology, Inc.
www.onsitetech.com
503-233-1418
Taking e-Business and Internet Technology To The Extreme!
----- Original Message -----
From: Jason White
To: pdx-pm-list at pm.org
Sent: Wednesday, June 05, 2002 1:56 PM
Subject: regular expression matching
I usually only use regular expressions for substitutions s///g etc.
How exactly do I use a regular expression as a boolean value?
for example:
Jason White
TIMTOWTDI
More information about the Pdx-pm-list
mailing list