[lug] vi wildcards

Hugh Brown hugh at vecna.com
Thu May 24 09:02:52 MDT 2001


Alan's trick should be used because of greedy matching.

This substitue line

:%s/<SPAN CLASS=".*">//g

will also match <SPAN CLASS="something"><A HREF="some other
stuff">

because it matches all the way up to the very last "> on the line

Hugh


"Chip Atkinson"
> 
> Are you trying to delete all the tags that start with "<SPAN CLASS" and 
> end with ">" ?  If so, it looks like you need the . metacharacter.  It 
> represents the character generated by the "any" key.  :-)
> 
> The patterns you have below will match
> <SPAN CLASS="""""""""""""""""""""">
> or
> <SPAN CLASS=">
> or anything with only quotes and a > following the CLASS.  I believe if 
> you use
> :%s/<SPAN CLASS=".*">//g
> that it will work.  Also, 1,$s works as well.  The % is the same as 1,$.
> The * is a count qualifier and means match 0 or more of the preceeding 
> character.  This is not to be confused with glob matching like you get 
> in the shell.  A glob type pattern of  "* would match "abc or """"" , 
> where as a regular expression pattern of "* would match """"" but *not* "abc
> 
> Chip



More information about the LUG mailing list