Re: Regex to matching Parenthesis

2007-09-13 Thread Chas Owens
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 ("

Re: Regex to matching Parenthesis

2007-09-13 Thread Jay Savage
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 >

Re: Regex to matching Parenthesis

2007-09-07 Thread Aruna Goke
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

Re: Regex to matching Parenthesis

2007-09-07 Thread John W. Krahn
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; #

Re: Regex to matching Parenthesis

2007-09-06 Thread Aruna Goke
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

Re: Regex to matching Parenthesis

2007-09-06 Thread Chris E. Rempola
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-

Re: Regex to matching Parenthesis

2007-09-06 Thread John W. Krahn
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

Re: Regex to matching Parenthesis

2007-09-06 Thread Chris E. Rempola
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

Re: Regex to matching Parenthesis

2007-09-06 Thread John W. Krahn
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