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

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



On Wed, 31 May 2000, Mike Hicks wrote:

> 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

Ah, thank you. I really need to buy "Mastering Regular Expressions"...

I also needed to add "g" to the end to find all occurances; It was only
finding one <font> tag per line.

I've ended up with the following little blurb:

perl -i -p -e 's/<\/*font.*?>//ig' [filenames]

It works pretty nice, but doesn't match font tags that break across
newlines. I tried trowing a \n* in there and adding "s" so that it treats
the string as a single line, but neither helped. 

This is OK since I can clean those culprits out by hand. Still, any ideas
on how to fix that?

Thanks, 

Luke