DreamWeaver - Remove all Text Formatting - CSS and otherwise

They have: 6 posts

Joined: Nov 2004

my old roomie was an ace w/ dreamweaver... i seem to recall him typing some advanced commands in the find/ remove function which globally removed font formatting from an html document. he's no longer around to help. boohoo!

MY PROBLEM:
existing html doc has tables, images, etc, but my text formatting is very sloppy cause it was done during my learning period from inline to CSS formatting.

anyone know of a quick fix to remove ALL formatting and bring my text back down to absolutely plain?

once i get there, i plan to go back in and hit it w/ the proper CSS code.

thanks!

for reference, the document is here http://www.dantesinc.com/calendarbody.htm

support your local live music
visit the East Coast Band Network
a place for musicians to network about the biz.

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

So you want to remove *all* tags? Or just some text formatting ones, like , , etc?

Your friend probably used a regular expressions search; I don't know how it works in Dreamweaver but it probably involves you entering something like this in a Find and Replace dialog box:

//Strip all tags
Search for: \<.+?\>
Replace with: <em>nothing</em>
'

//Strip <font> and </font> tags
Search for: \<\/?font.*?\>
Replace with: <em>nothing</em>
'

If you want this to apply to a particular section of your code (like between tags) then it would be easiest to highight it and use "search within highlighted text", if Dreamweaver has that or a similar facility. Or you could copy the relevant code to a new window and run the search/replace process.

You might want to flag case-insensitivity and replace-all in the dialog box if such options are available. If not, add /ig on to the end of the regex above.

Note: I use PERL type regex because that's all I know. Sticking out tongue I don't know if Dreamweaver will like that or has a flag for it somewhere. (My editor has special choices for PERL and POSIX regex.)

Is this useful? Smiling

They have: 6 posts

Joined: Nov 2004

Abhishek Reddy wrote: So you want to remove *all* tags? Or just some text formatting ones, like , , etc?

oops... i missed your request for me to clarify.

it's just the text formatting, i think.

the result i seek is to keep the tables, images, anchors, etc where they are; to retain the 's and 's etc, but to remove all font style references including color, size, weight, classes, etc.

support your local live music
visit the East Coast Band Network
a place for musicians to network about the biz.

They have: 6 posts

Joined: Nov 2004

yes, this is useful. thank you!

i'm not sure what's going on in your search tearms there, but i'll experiment. could you remark what the syntax means so that i might understand a bit better? i would greatly appreciate that, and i think it would make this thread of more help to any other passers by.

what editor are you using... perhaps i will obtain a copy and try your Exact procedure.

support your local live music
visit the East Coast Band Network
a place for musicians to network about the biz.

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Sure. Smiling

Search for: \<.+?\>'
Essentially, this searches for "anything in between < and >". So any HTML type tags, including closing tags will match.

  • \< represents the < character; the \ is used to "escape" it.
  • .+ means "any characters, any number of times"; it's similar to the * wildcard you may have encountered with search engines.
  • ? ensures that the search is not "greedy"; i.e. it will match but not important text .
  • \> as with the first part, it matches the > character.

Search for: \<\/?font.*?\>'
This one is more complex, it searches for all tags beginning with "font", including tags.

  • \< the < character.
  • \/? checks for a forward-slash character; the ? allows for no match, such as in opening tags.
  • font literal string "font".
  • .*? similar to .+? the previous expression; it allows for anything like tag properties (matches family="xyz">).
  • \> the > character.

I use Bluefish on GNU/Linux for the most part. Smiling

They have: 6 posts

Joined: Nov 2004

thanks again! your remarks on the syntax will be very helpful! i am one to work on several projects simultaneously, and this one is on the back-burner by now, but i'll update this thread after i try your suggestion.

it's obvious to me that you are trying to help, which, for what it's worth, has alleviated some frustration on this end-- just knowing that genuine help is available. oftentimes, when a question of this nature is presented in a forum such as this, the inquirer is either mocked or ignored-- or told the obvious... to simply "start over, dummie!". but i am thankful for your attention to my problem, and your appreciation for my attempt at fixing it w/ a "automatic" method such as this. everyone knows my best bet is to start over from scratch, but that's not the point. the point is, i'm trying to learn how to increase productivity if i encounter a similar scenario in the future when perhaps i won't have the luxury of "starting over".

kudos to you, and to the Webmaster Forums.

-js

PS. i followed the URL to BlueFish. from what i can tell, to my dismay, it doesn't run on Windows XP OS, and i don't do Linux. any suggestions for a similar editor (open source, or otherwise) which may have a search function which will respond to the syntax as described above by Abhishek Reddy?

i feel like i'm putting the cart before the horse here, because i haven't tried this search function in DreamWeaver yet, but i figure i'd ask in advance... cause i get the feeling that DW might not like those terms... just a wild guess though.

support your local live music
visit the East Coast Band Network
a place for musicians to network about the biz.

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

regex is definitely great for productivity. Useful skill to have no matter what kind of programming, or indeed power-usage, you do. Smiling

Editpad or Textpad are good editors for Windows. Both have some form of free-of-cost version that you can try, I think.

Here's a modified version of the second expression to handle multiple types of tags:

Search for: \<\/?(font|b|i|u|em|s|strike|sup|sub).*?\>
<em>[untested]</em>
'

Best thing you can do now is to try these out. If you want more in-depth information on regex specifically, there would be way too much to explain in a forum post; you'd have to google for that -- I'd encourage you to do so anyway. Still, feel free to ask any more questions -- we're here to (try to) help. Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.