Dreamweaver – Find and Replace

I’m working on converting a web site from tables and old fashioned tags to CSS and semantic page structure. And I thought to myself, wouldn’t it be nice if I could easily do a ‘Find and Replace’ in Dreamweaver or Homesite, where I can determine the starting tag and ending tag, with the text in the middle acting like a variable.

So I asked my friend if he knew of a way to do that, and with his help we figured it out using regular expressions. Here’s the breakdown…

In the dialog box, this text goes in the ‘Find’ field:
<span class=subtitle>([^<]*)</span>

And this in the ‘Replace’ field:
<h4>1</h4>

You need to make sure that the ‘Regular Expressions’ checkbox is CHECKED. The text between the tags in the examples above are the regular expressions.

If you want to have more than one “variable”, then you’ll need to add on numbers in the replace field, like this…

Find field:
<div style="padding-bottom: 5px; margin-top: 30px;" class=subtitle><a
href="([^<]*)">([^<]*)</a></div>

Replace field (number each variable):
<h2><a href="1">2</a></h2>

About Nicole

I'm a quiet artist making a living as a web designer.
This entry was posted in Technical. Bookmark the permalink.

2 Responses to Dreamweaver – Find and Replace

  1. FoundByGoogle says:

    AWESOME! What an incredible time-saver… Thanks very much for posting this info!

  2. Nicole says:

    I’m so glad it was helpful!

Leave a Reply

Your email address will not be published. Required fields are marked *