From owner-freebsd-questions Tue Oct 23 10:49: 1 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mobil.cz (diana.mobil.cz [195.39.16.12]) by hub.freebsd.org (Postfix) with ESMTP id E56AB37B409 for ; Tue, 23 Oct 2001 10:48:57 -0700 (PDT) Received: from ester.mobil.cz ([194.228.207.250]) by mobil.cz (8.11.6/8.11.0) with ESMTP id f9NHmuv29049 for ; Tue, 23 Oct 2001 19:48:56 +0200 Received: from roman.mobil.cz ([10.2.0.89]) by ester.mobil.cz (Lotus Domino Release 5.0.7) with ESMTP id 2001102319455933:331 ; Tue, 23 Oct 2001 19:45:59 +0200 Received: (from roman@localhost) by roman.mobil.cz (8.11.6/8.11.6) id f9NHrLO09050 for freebsd-questions@freebsd.org; Tue, 23 Oct 2001 19:53:21 +0200 (CEST) (envelope-from neuhauser@mobil.cz) X-Authentication-Warning: roman.mobil.cz: roman set sender to neuhauser@mobil.cz using -f Date: Tue, 23 Oct 2001 19:53:20 +0200 From: Roman Neuhauser To: freebsd-questions@freebsd.org Subject: Re: regex(3), re_format(7) and shortest match Message-ID: <20011023195320.B8947@roman.mobil.cz> Mail-Followup-To: freebsd-questions@freebsd.org References: <3BD5A7F4.748285AA@verizon.net> <20011023194940.A8947@roman.mobil.cz> Mime-Version: 1.0 In-Reply-To: <20011023194940.A8947@roman.mobil.cz> User-Agent: Mutt/1.3.23i X-MIMETrack: Itemize by SMTP Server on ester/Mobil(Release 5.0.7 |March 21, 2001) at 10/23/2001 07:45:59 PM, Serialize by Router on ester/Mobil(Release 5.0.7 |March 21, 2001) at 10/23/2001 07:46:05 PM, Serialize complete at 10/23/2001 07:46:05 PM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > Date: Tue, 23 Oct 2001 10:25:08 -0700 > > From: Shill > > To: freebsd-questions@freebsd.org > > Subject: regex(3), re_format(7) and shortest match > > > > Say I have the string: > > "yo hiphop fun" > > > > I want to isolate individual "" subexpressions. > > > > The naive regex I used was: () > > > > Of course, that doesn't work since it returns the longest match, in my > > case " hiphop ". > > > > I battled with bracket expressions and collating elements for three > > hours to no avail. Can anyone tell me how to achieve the shortest match? > > > > i.e. the first call to regexec() would return "" and the > > second would return "". > > Try this: () What was I thinking... () Sorry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message