On 9/13/07, Jay Savage <[EMAIL PROTECTED]> wrote:
snip
> I'm actually a little confused about this. I never really thought
> about it, but the doc seems to indicate that $1 is a s bad as $& ("the
> same mechanism"). But then it implies that capturing parentheses only
> affect particular patterns ("
On 9/7/07, John W. Krahn <[EMAIL PROTECTED]> wrote:
> Aruna Goke wrote:
>
> > print $&, if $f=~m/\S+$/;
>
> perldoc perlre
> [ snip ]
> WARNING: Once Perl sees that you need one of $&, $`, or $' anywhere in
> the
> program, it has to provide them for every pattern match. This may
>
John W. Krahn wrote:
Aruna Goke wrote:
Chris E. Rempola wrote:
How would you match Parenthesis in Perl?
- STRING -
Received: from 10.143.205.68.abc.def.gh.com (10.205.143.238)
- /STRING -
I want to be able to grab the IP address in (10.205.143.238).
Thanks in advance.
#/usr/bin/perl
use w
Aruna Goke wrote:
Chris E. Rempola wrote:
How would you match Parenthesis in Perl?
- STRING -
Received: from 10.143.205.68.abc.def.gh.com (10.205.143.238)
- /STRING -
I want to be able to grab the IP address in (10.205.143.238).
Thanks in advance.
#/usr/bin/perl
use warnings;
use strict;
#
Chris E. Rempola wrote:
How would you match Parenthesis in Perl?
- STRING -
Received: from 10.143.205.68.abc.def.gh.com (10.205.143.238)
- /STRING -
I want to be able to grab the IP address in (10.205.143.238).
Thanks in advance.
#/usr/bin/perl
use warnings;
use strict;
#use re 'debug';
my
John W. Krahn wrote:
Chris E. Rempola wrote:
/(\(\d+\.\d+\.\d+\.\d+\))/ #This prints out (10.205.143.238)
How about if I wanted to just grab the IP address itself?
Put the capturing parentheses *inside* the literal parentheses.
Ahh...That explains it. Thanks John!
--
To unsubscribe, e-
Chris E. Rempola wrote:
Chris E. Rempola wrote:
How would you match Parenthesis in Perl?
- STRING -
Received: from 10.143.205.68.abc.def.gh.com (10.205.143.238)
- /STRING -
I want to be able to grab the IP address in (10.205.143.238).
I found out escaping them with '/' works. The following
Chris E. Rempola wrote:
How would you match Parenthesis in Perl?
- STRING -
Received: from 10.143.205.68.abc.def.gh.com (10.205.143.238)
- /STRING -
I want to be able to grab the IP address in (10.205.143.238).
Thanks in advance.
I found out escaping them with '/' works. The following worke
Chris E. Rempola wrote:
How would you match Parenthesis in Perl?
- STRING -
Received: from 10.143.205.68.abc.def.gh.com (10.205.143.238)
- /STRING -
I want to be able to grab the IP address in (10.205.143.238).
my ( $IP_address ) = $string =~ /\(([\d.]+)\)/;
John
--
Perl isn't a toolbox, b