Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2001 10:25:08 -0700
From:      Shill <shill@free.fr>
To:        freebsd-questions@freebsd.org
Subject:   regex(3), re_format(7) and shortest match
Message-ID:  <3BD5A7F4.748285AA@verizon.net>

next in thread | raw e-mail | index | archive | help
Say I have the string:
"yo <a --- </a> hiphop <a +++ </a> fun"

I want to isolate individual "<a ... </a>" subexpressions.

The naive regex I used was: (<a.*</a>)

Of course, that doesn't work since it returns the longest match, in my
case "<a --- </a> hiphop <a +++ </a>".

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 "<a --- </a>" and the
second would return "<a +++ </a>".

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BD5A7F4.748285AA>