Removing <font> tags in Dreamweaver fast method

Ok, using find and replace isn’t hard, but is there anyway to strip a document of <font> tags easily?

Reason I ask is because some have different font sizes and faces within the font tag, and if you only do a search for <font its not going to give you very good results.

Thanks
Bryan

Basically, in a nutshell, I want t remove anything that is in relation to a font tag. The inside element, the closing tag the whole kit kaboodle.

Commands -> Clean Up HTML -> Remove specific tags ->Type “font” (no quotes) -> Profit.

heh…i never truested that clean up command…call me old-fashioned, but i used to always do a find/replace with regular expressions…

replace


</{0,1}font[^>]*>

with nothing.

cool, I will give that a whirl

I just did the long way, where I was cutting and pasting the code into the find and replace, because this page has so many different variations and combos with the font tag. The page was 116kb in file size, after all <font> material was removed, 80kb :slight_smile:

wow

The clean up method works surprisingly well. Not that it takes away much time from copy/pasting a regular expression in the search box though ;).

any chance you can explain how that expression works redux?

Here’s the whole expression:


</{0,1}font[^>]*>

This part:


</{0,1}

Searches for the tag beginning (the < ), and zero or one slashes (it can be an opening or closing font tag).

This part:


font[^>]*

Searches for the word “font” and anything not matching an end tag (attributes, etc.).

Then the last part:


>

Searches for the end of the tag.

See, regular expressions are easy :).

I want to kiss both of you :slight_smile: OK, how about a firm handshake!?

That is one of the most time saving tips I have ever been shown.

I just did it to one document, in a matter of about 1 minute, it found 530 items matching the criteria :slight_smile: whoa

There is a feature in DWMX 2K4 that states to use “CSS” to write HTML. This will create new styles that encapsulate the HTML equivalent (to an extent) rather than write the <font>, <b>, <i>, <u> and other HTML formatting tags. This also helps keep your document and design seperate.

I posted a similar regular expression on your post yesterday about the page with all the font tags. You can also use the standard search/replace dialog and select “Specific Tag” for the search criteria. It has a lot of options for surgical precision in replacing attributes and elements, although for pure tag stripping I generally use RegEx for search/replace also.

RegEx replacing is fast and easy, especially if you just save the search. Unlike the search dialog, you can just open the saved search expression and hit “Replace All”, instead of reconfiguring the criteria for each replace you want to perform.