From owner-freebsd-questions@FreeBSD.ORG Fri Jul 23 16:05:05 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A4F216A4CF for ; Fri, 23 Jul 2004 16:05:05 +0000 (GMT) Received: from cactus.fi.uba.ar (cactus.fi.uba.ar [157.92.49.108]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7C5AF43D39 for ; Fri, 23 Jul 2004 16:05:04 +0000 (GMT) (envelope-from fgleiser@cactus.fi.uba.ar) Received: from localhost (localhost [127.0.0.1]) by cactus.fi.uba.ar (8.12.11/8.12.11) with ESMTP id i6NG5708076085; Fri, 23 Jul 2004 13:05:08 -0300 (ART) (envelope-from fgleiser@cactus.fi.uba.ar) Date: Fri, 23 Jul 2004 13:05:07 -0300 (ART) From: Fernando Gleiser To: Steve Bertrand In-Reply-To: <1718.209.167.16.15.1090596743.squirrel@209.167.16.15> Message-ID: <20040723130007.V6864@cactus.fi.uba.ar> References: <1718.209.167.16.15.1090596743.squirrel@209.167.16.15> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Score: -104.901 () BAYES_00,USER_IN_WHITELIST X-Scanned-By: MIMEDefang 2.42 cc: freebsd-questions@freebsd.org Subject: Re: Perl split() question (OT)... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jul 2004 16:05:05 -0000 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