TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:18438] regex for stripping FONT tags?



Luke Francl wrote:
> 
> Hi all,
> 
> We're making the arduous conversion from structured markup to CSS here at
> work. To make my life a little easier, I'm trying to write a little one
> liner Perl script to remove the <font></font> tags from an HTML
> document. Unfortunately, my regex is a little too trigger happy and is
> removing everything between the font tags as well! No good! (I thought
> Perl used greedy regexs which got rid of this problem?)
> 
> Anyway, here's what I'm trying to use:
> 
> s/<\/*font.*>//i

I think you might try

s/<\/*font.*?>//i

The ? will make the regex find the nearest ">" rather than one at the
end of the line or the end of the document

I think...

-- 
 _  _  _  _ _  ___    _ _  _  ___ _ _  __   Vulcans have less fun. 
/ \/ \(_)| ' // ._\  / - \(_)/ ./| ' /(__                              
\_||_/|_||_|_\\___/  \_-_/|_|\__\|_|_\ __)                             
[ Mike Hicks | http://umn.edu/~hick0088/ | mailto:hick0088@tc.umn.edu ]