Using Regular Expressions with Dreamweaver’s Find and Replace

Using Regular Expressions with Dreamweaver's Find and Replace

Having had the pleasureable task of cleaning up code, I’ve found using regular expressions with Dreamweaver’s Find and Replace tool to be a lifesaver.

Say you have several links on a page that need to be updated so they all point to the same url. Instead of manually changing every link, we’ll let Dreamweaver’s Find and Replace tool and regular expressions automate this for us.

The magic behind this is using our little expression: [^"]*

Here’s a breakdown of what these characters are doing.

  • ^ Match any character starting from this point
  • ” Stop once you’ve reached a quote
  • * Match the preceding character zero or more times

Basically, this means we want to find whatever information is between the two quotes and replace it.

Regular expressions are a very valuable tool. The expression above is only one way in which they can be used. For an in depth tutorial, checkout ThemeForest’s – Regular Expressions for Dummies.

Just a word of caution… please be sure to make a backup copy first. If you ever need to refer back to the original, or if you accidently replaced code that you shouldn’t have, you’ll thank yourself later.

Sharing is caring.
  • Subscribe to our feed
  • Share this post on Delicious
  • StumbleUpon this post
  • Share this post on Digg
  • Tweet about this post
  • Share this post on Mixx
  • Share this post on Technorati
  • Share this post on Facebook
  • Share this post on NewsVine
  • Share this post on Reddit
  • Share this post on Google
  • Share this post on LinkedIn

Discussion

4 responses to "Using Regular Expressions with Dreamweaver’s Find and Replace"

Leave a Comment