From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <7359f04904050909514b882f5c@mail.gmail.com> From: Rob Pike To: 9fans@cse.psu.edu Subject: Re: [9fans] sam regexp coverage In-Reply-To: <2639078ba1a669e2ca3eeb93d1ae1372@mteege.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <2639078ba1a669e2ca3eeb93d1ae1372@mteege.de> Date: Sun, 9 May 2004 09:51:44 -0700 Topicbox-Message-UUID: 750f6ca2-eacd-11e9-9e20-41e7f4b1d025 your problem is that .* is greedy. instead of .*" (maximal sequence of anything followed by quote) write [^"]*" (maximal sequence of not-quote, followed by quote). you don't need the backslashes for : and ". -rob On Sun, 9 May 2004 16:28:17 0000, Matthias Teege wrote: > > I have another small problem with sam and regexp. I have a text > with a lot of constructs like this one: > > Hello world http://my.domain:"This is a link" more text and > http://another.domain:"This is another link" follows more text > > Now I try to translate the link in html syntax with > ,x/(http.*)\:\".*\" s/(http.*):\"(.*\n*.*)\"/\2<\/a>/ > > The problem is, that the regexp matches both "links" not only > the first ore the second one. I've tried to find a better one but > its hopeless. ;-) > > Thanks for any hint > Matthias >