From owner-freebsd-questions Tue Oct 23 10:29:45 2001 Delivered-To: freebsd-questions@freebsd.org Received: from smtp006pub.verizon.net (smtp006pub.verizon.net [206.46.170.185]) by hub.freebsd.org (Postfix) with ESMTP id D6D5337B403 for ; Tue, 23 Oct 2001 10:29:41 -0700 (PDT) Received: from verizon.net (lsanca1-ar14-096-036.lsanca1.dsl.gtei.net [4.41.96.36]) by smtp006pub.verizon.net with ESMTP for ; id f9NHTdv18033 Tue, 23 Oct 2001 12:29:40 -0500 (CDT) Message-ID: <3BD5A7F4.748285AA@verizon.net> Date: Tue, 23 Oct 2001 10:25:08 -0700 From: Shill X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: regex(3), re_format(7) and shortest match Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 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 "". Any help will be *greatly* appreciated. Shill To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message