Regular expressions REGEX to use in Dreamweaver

Regular expressions REGEX to use in Dreamweaver

Found this to be very helpful so I thought to share my notes.

I'm big on using the search with regular expressions in Dreamweaver which by the way works not only on the open files but you can also select entire folders where u can do search and replace, but I couldn't figure it out in a long time how to change the code while preserving the content in between the html brackets.

For example, let's assume you want to make the font bold for the content in all TDs. You can use Dreamweaver to search for all TDs like this (don't forget to select Regular Expressions in Dreamweaver):

<td>.*?</td>

That will find all the TDs but it won't help you to leave the content unchanged. So, after some long time digging into Regex, I found adding brackets does the job:

(.*?)

This is how it works, search for:

>(.*?)</td>

Replace with:

><strong>$1</strong></td>

Dreamweaver is being an ass recently because of some copy/paste issues I keep running into - it pastes partially so I need to close Dreamweaver, delete the temp file, clear the clipboard and sometimes even restart my PC. The most annoying this is that I lose my undo - if I want to revert there is no way since I closed Dreamweaver (or how I call it now, badDreamweaver, ha!). Hopefully that gets fixed sooner than later. Other than that is a great piece of software, the search & replace function is a life saver - saved me tons of time.

I hope this small coding tip helps you like it's helping me. Happy coding!

Your friend, the email snob.