9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Rob Pike <robpike@gmail.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] sam regexp coverage
Date: Sun,  9 May 2004 09:51:44 -0700	[thread overview]
Message-ID: <7359f04904050909514b882f5c@mail.gmail.com> (raw)
In-Reply-To: <2639078ba1a669e2ca3eeb93d1ae1372@mteege.de>

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 <matthias@mteege.de> 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*.*)\"/<a href=\"\1\">\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
>


  reply	other threads:[~2004-05-09 16:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-09 16:28 Matthias Teege
2004-05-09 16:51 ` Rob Pike [this message]
2004-05-10  1:00   ` boyd, rounin
2004-05-10  0:23 ` boyd, rounin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7359f04904050909514b882f5c@mail.gmail.com \
    --to=robpike@gmail.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).