Multiple File Search & Replace using Dreamweaver MX and regular expressions
About a month ago I needed to do some work on a site where I needed to change a lot of code on every page. I set up IIS on my machine and copied the site to it. I then set up Dreamweaver so that I would work on the site locally. When I opened Dreamweaver I had all the files for my site listed on the left side. I found that when I did a search and replace in Dreamweaver I had the option to do it to the entire current site. That was real cool and I was using for some simple things. I got to a point where I needed to switch out some tags with
The problem was that I need to find a string but leave the stuff inside the tags alone. Dreamweaver allows the use of regular expressions. I know very little about regular expressions so I was looking everywhere on how to do this. I finally found one document online that told me how. I canâ€™t remember what that was but here is what I learned. I use (.+) in the search and $1 in the replace. If I want to find <span class=”HeaderL1″>My Heading</span> with <h1>My Header</h1> I search for <span class=”HeaderL1″>(.+)</span> and put <h1>$1</h1> in the replace field. I then tell it to search and replace the entire site. Make sure to have â€śuse regular expressionsâ€ť checked.