Date: Tue, 23 Oct 2001 12:52:07 -0700 From: Shill <shill@free.fr> To: freebsd-questions@freebsd.org Subject: Re: regex(3), re_format(7) and shortest match Message-ID: <3BD5CA67.F591A343@verizon.net> References: <3BD5A7F4.748285AA@verizon.net> <20011023194940.A8947@roman.mobil.cz>
next in thread | previous in thread | raw e-mail | index | archive | help
>> Say I have the string: >> "yo <a --- </a> hiphop <a +++ </a> fun" >> >> 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>". > Try this: (<a[^<]*</a>) What if '<' '/' 'a' '>' are all valid characters inside "<a ... </a>"? i.e. if I have the string "yo <a %<%/%a%> </a> hiphop" a call to regexec() should return "<a %<%/%a%> </a>". If I use the (<a[^<]*</a>) regex, it would just return REG_NOMATCH. 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?3BD5CA67.F591A343>