Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

vim regexp non-greedy search

6 views
Skip to first unread message

kurt krueckeberg

unread,
Nov 7, 2009, 8:35:51 PM11/7/09
to
I want to change all occurances of
<FONT SIZE=3>some text goes here</FONT>
to
some text goes here</FONT>
Preferrably to just:
some text goes here

How do I compose a non-greedy regular expression to find "<FONT
SIZE=3>"? I've tried
:%s/<FONT\(.*\)\{-1}>//g

But the eliminates the entire line.

thanks.

Peter Gordon

unread,
Nov 7, 2009, 11:10:22 PM11/7/09
to
kurt krueckeberg <kkru...@gmail.com> wrote in news:e75a9ba1-2614-480f-
9ec8-2a0...@p35g2000yqh.googlegroups.com:

> <FONT SIZE=3>some text goes here</FONT>
>

If the opening & closing anchors are guaranteed to be on the
same line, the RE below will do it.

s%<FONT SIZE=3>\(.*\)</FONT>%\1%

Christian Brabandt

unread,
Nov 8, 2009, 3:01:28 AM11/8/09
to

Why are you posting here and in the vim_use mailinglist?

regards,
Christian

Tim Roberts

unread,
Nov 10, 2009, 2:22:40 AM11/10/09
to
kurt krueckeberg <kkru...@gmail.com> wrote:

Think about it in words. You want <FONT followed by any number of things
that aren't >, followed by >.

:%s/<FONT[^>]*>//
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

0 new messages