Thanks Jeff, that worked!!
one question, I am confused how you did that in this REg Exp:
/((?:\d{1,3}\.){3}\d{1,3})/
what is this part: (?:\d{1,3}\.)
and this: {3}\d{1,3}
I am lost.... jst want to understand, or if youwant to refer me to a page
on the Camel book I can look it up myself. Thanks again!!
Paul
-----Original Message-----
From: Jeff 'japhy/Marillion' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 06, 2001 3:32 PM
To: Paul Jasa
Cc: [EMAIL PROTECTED]
Subject: Re: Reg exp into variable
Importance: High
On Sep 6, Paul Jasa said:
>How do I put something I am looking for, and find, with a reg expression
>INTO a variable?
You want to capture the specific part of the regex with ( and ), and then
set that equal to a variable. There are two ways of doing that:
if (/(pattern)/) {
$x = $1; # $1 is the first set of ()'s
}
and
($x) = /(pattern)/;
So you probably want:
if ($iplist =~ /((?:\d{1,3}\.){3}\d{1,3})/) {
print "found $1\n";
}
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]