Date: Fri, 23 Jul 2004 13:05:07 -0300 (ART) From: Fernando Gleiser <fgleiser@cactus.fi.uba.ar> To: Steve Bertrand <iaccounts@ibctech.ca> Cc: freebsd-questions@freebsd.org Subject: Re: Perl split() question (OT)... Message-ID: <20040723130007.V6864@cactus.fi.uba.ar> In-Reply-To: <1718.209.167.16.15.1090596743.squirrel@209.167.16.15> References: <1718.209.167.16.15.1090596743.squirrel@209.167.16.15>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 23 Jul 2004, Steve Bertrand wrote: > Perl hackers -- Figured someone would have a reasonably quick, easy answer > for this: > > I am trying to read through a file, line-by-line, and I want to extract > the text in between the [ and ] characters. This is a job for......capturing parens!!! Try this: if ($_=~/\[(.+)\]/) { $var=$1; } $1 would be the string matched by the regex between ( and ) Fer
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040723130007.V6864>