kurt krueckeberg wrote:
> I want rmove the "<FONT SIZE=3"> from the line below
> 
>   <FONT SIZE=3>some text goes here</FONT>
> 
> so it looks like:
> 
>   some text goes here</FONT>
> 
> Actually, I prefer to also remove "</FONT>", so I just have:
>   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
               ^
This "*" is greedy.  I think you want

   :%s@</\=FONT.\{-}>@@g

which is

  <     a literal "<"
  /\=   an optional "/"
  FONT  the literal tag
  .\{-} any character, as few as possible
  >     a literal ">"

You might put optional whitespace before the slash or FONT, making it

   :%s@<\s*/\=\s*FONT.\{-}>@@g

and optionally allow case-insensitivity with the "\c" token:

   :%...@\c<\s*/\=\s*FONT.\{-}>@@g

As a non-greedy alternative, you might also consider something 
like the character-class "[^>]"

   :%s@<\s*/\=\s*FONT[^>]*>@@g

Hope this gives you what you need as well as some ways to riff on 
the theme.

-tim




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to