Search, Capture, & Replace in Dreamweaver

Recently, I needed to search all URLs in a document in Dreamweaver and wrap them with <a> tags to turn them into links. The URLs themselves would be the text to click on. In Dreamweaver, you can use regular expressions and capture matches for use in replacements as follows:

[cc lang=”html”]SEARCH: ((https?|ftp|file)://S+)
REPLACE:  $1[/cc]

Notice I wrapped the SEARCH regex with parentheses ( ) to capture that match and use it in the REPLACE using $1. If I had more parentheses to capture other matches, I could use them in the REPLACE using $2, $3, and so on.

Make sure you have “Regular Expressions” checked when you do this.