More Dreamweaver Regular Expressions

A while back I offered up a pack of Dreamweaver regular expressions for download. Well, I have been doing some significant front-end work lately which has required quite a bit of rewriting of old HTML to a more standards-centric foundation. During this process, I have been writing a few additional regular expressions (aka regexes). I was somewhat surprised by the level of interest in the original set of regexes so I thought it would be helpful to release an updated collection of regular expressions.

Some of the more useful regexes replace two common depreciated tags (b and i with the suggested replacements for those tags (strong and em). It can be amazingly tiring to have to manually change each b to strong, i to em and so on. In addition, I made some regexes to replace invalid characters with the UTF-8 counterpart. For example, the left quote would be replaced with “. So far, I have character replacement regexes for the following characters:

  • ampersand (&)
  • left quote ()
  • right quote ()
  • en dash ()
  • apostrophe ()

These simple changes will make your typography more presentable while making your HTML more accessible. If you are still manually replacing code or even just using the simple find/replace feature in Dreamweaver, I am highly suggesting that you stop wasting your time. I have added these regexes to the original zip file. I am assuming that this collection will grow in the upcoming weeks.

Download Dreamweaver Regular Expressions Pack

10 thoughts on “More Dreamweaver Regular Expressions”

  1. Since your last post on the subject of regular expressions I will admit ive been steadily using them more and more. Thanks for these additional ones too – great resource you’ve given us PJ 😉

  2. I use Coldfusion and I was wondering if it is possible to create a regular expression to do the following?

    Replace………

    WHERE CategoryID = #Val(ARGUMENTS.CategoryID)#

    or

    WHERE AdID = #Val(ARGUMENTS.AdID)#

    With………

    WHERE CategoryID =

    WHERE AdID =

    etc

  3. nice work m8.

    one thing I have been wondering is, Can regular expressions be used in dreamweaver to insert alt tags in image tags that dont have them.And is there a way to check if a image tag has the xhtml closing and if not insert one

    or this outside of the scope of reg ex

  4. I learned a few things from the articles, though I learned regexes in college for programming. possible error in code? is missing a space between those 2 attributes in every file. please fix. thanks. my efforts to try my own regexes in DW8 have been fruitless, the complex regexes I tried break dw.

  5. I’m sorry, I’m a total newbie. Which folder do I put these files in once downloaded?

    I am hoping your files will save me time from finding and replacing. Thanks!

Leave a Reply

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