Regular Expressions In Dreamweaver

Print Friendly, PDF & Email

When managing a website with thousands of static pages, it can be very time consuming to change information on each page one by one. Sometimes, a simple find and replace command isn’t enough, either. Luckily, with Dreamweaver, it is very easy to change text on the fly.

In my latest endeavor, I was presented with webpages that each contained lists of items and dates hundreds of rows long. They were formatted something like:

Article Name by Author – Posted 3/12/2010
Article 2 by Author 2 – Posted 2/5/2010
Article 3 by Author 3 – Posted 9/17/2009

And so on. I needed to change all the posted dates so a single date, 12/22/2010. I loaded up Dreamweaver and entered this code into the find and replace box box:

Find: Posted:[^”]*</h4>
Replace: Posted: 12/22/2010</h4>

dreamweaver regular expressions

This allowed me to change the date on thousands of lines in mere minutes. Using the specific code “[^”]*” serves as a wildcard, so anything that is between the “Posted:” and “</h4>” is changed to whatever I specify in the replace field.

The regular expression function of Dreamweaver has all sorts of nifty functions, but this is the one I find myself using the most.

No comments yet.

Leave a Reply