[thelist] no more font tags?

Matt Patterson ltu97mp at reading.ac.uk
Mon Jun 4 10:44:40 CDT 2001

On 4/6/01 at 10:13 am, charliel at infohwy.com (Charlie Llewellin) wrote:

> Yes, this is really useful..
> You don't need the upper case "FONT", though, as unless case-sensitive is
> turned on, BBEdit at least will take care of both versions.
> <[\/]*tag[^>]*>
> Charlie
> > A better expression is this one:
> >
> > <[\/]*[font|FONT][^>]*>

<tip type="search and replace" author="Matt Patterson">

To grab a whole tag set, remove it and leave the middle behind do something like this (in BBEdit, with grep turned on and case sensitivity turned off...)

Search for: <tag[^>]*>(.*)</tag>

And, in the replace box: \1

This works because the parens around .* make BBEdit 'remember' what that bit of the pattern matched, and then \1 in the replace box tells it to use the first remembered bit of the search string...
NB: This doesn't work with tags which start on one line but end on another because in BBEdit Grep will only search a line at a time... In Perl you can tell use this same technique and force it to look across multiple lines, and you could always delete all line breaks before you searched and replaced (if you were so inclined)</tip>



Matt Patterson:
   Reading University
   Department of Typography & Graphic Communication

   ltu97mp at reading.ac.uk

   'Is Piglet organdized too?' asked Pooh.
   'We all are,' said Rabbit.

More information about the thelist mailing list