1. Computing & Technology

Discuss in my forum

Jennifer Kyrnin

Global search and replace is a lifesaver

By , About.com GuideDecember 4, 2007

Follow me on:

When I first started doing Web development, global search and replace meant going onto the Web server and running sed and awk across my files and hoping that my regex wasn't badly formed. But thank goodness, those days are long gone! Now, most high-quality Web editors allow you to do a global search and replace across all the files on your Web site. If you're not using an editor that has global search and replace, then I feel for you!
Comments
December 4, 2007 at 6:40 am
(1) Tim says:

Whilst find and replace is a brilliant tool, I do think certain text, urls, site name etc should all be stored in an include or DB to prevent you ever having to replace things across every page.

I learnt that the hard way and have never needed to use a global replace since.

December 5, 2007 at 11:30 pm
(2) Jason Champion says:

I have found that global search and replace can be very useful, but I also learned that it can be very dangerous as well. You have to be very careful because if you mistype, sure, you can always go back and do another global search and replace, but I’ve found that when searching and replacing for html entities, and css classes/IDs, it’s very important that you place your attributes in a standardized convention within the elements throughout the site. Otherwise, when you go back and attempt to *undo* something that was a mistake, it can be a major pain. When using Dreamweaver, you can not simply go back through each file and undo those changes, because it will save those files that are not currently open in the editor. Therefore, you have to be careful about the search/replace string that you use.

December 6, 2007 at 5:25 pm
(3) Ken Cooper says:

SSI should be used when building a functional website. Every URL should be unique. I feel for anyone who has to use global replace, and in time as they gain experience will have no need for such an editor.

December 6, 2007 at 5:36 pm
(4) Jennifer Kyrnin says:

Ken: I completely agree that SSI is a valuable tool. But you really can’t compare it to global search and replace. They are two different things.

For example, I was using SSI on a site with over 10,000 pages. At one point, we had to change where the main navigation SSI file was located (long story as to why). That meant that we had to go into every page on the site and update the header call to change that file name, ie from:

<!–#include virtual=”includes/navigation.ssi” –>

to

<!–#include virtual=”inc/navigation.ssi” –>

If we didn’t have global search and replace we would probably still be there manually updating files. As it was, it took about 5 minutes to convert all 10,000 pages.

December 11, 2007 at 1:07 pm
(5) Marco Conti says:

Nice to see an article on global searches. I work with dynamic websites and I use global searches all the time to find snippets of code in the file system.

However, the Dreamweaver S&R is at the most useful when all the different options are used, such as:
Search a group of files or folders
Search and interact with html tags, tag styles and contents
And what about the search results that allow you to click on them and open the file on the fly?

DW CS3 search is the most powerful among the leading HTML IDEs, but not just for the global search.

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>
Related Searches global search lifesaver

©2012 About.com. All rights reserved.

A part of The New York Times Company.