Community
Participate
Working Groups
Currently it is only possible to do a global replace, by first searching and then replace each occurrence manually. While this ensures that nothing is accidentally replaced, it is awful if you have use cases like the following: - I want to replace "DAO" to "Dao" and "XML" to "Xml" in all methods, classes, attributes, local variables etc. - I want to replace the copyright in all files - I want to replace all 'รค' (german special character) to "ae" or "ä" - I want to rename all classes that end with "Helper" to "Service" These kinds of things happen quite frequently if you incorporate code from one project into another because the responsibility for the code has changed or after a merger of two groups/companies. Often these to groups had different style guides that should now be consolidated. Or imagine taking over the ORO and the OJB stuff in the Jakarte project. And even if it would be better to have refactorings, a pragmatic approache sounds much better to me.
Would it help if the Replace dialog would offer a "Replace in All Files..." button?
It would help, to have such a button as a preliminary fix. That's what I tried to do, but since I never did any Eclipse hacking before, I did not achieve anything. But from my point of view it is so strange and unusual not to have a search dialogue with a replace possibility. I always have to serach, then select the found files, right click and then replace/replace in all files ... Anyway: for me a button "replace in all files" in the replace dialogue would help me tremendeously.
Any information on when this VERY VERY helpful feature would be implemented. Right now I always use Together or VisualJ++ to do a find/replace on all my sources.
It is currently not a high prio item for 2.1 (at most time permitting).
*** Bug 32709 has been marked as a duplicate of this bug. ***
*** Bug 34300 has been marked as a duplicate of this bug. ***
This is one of the main problems on the current version of Eclipse. Nice to know that a new solution will be included for version 3.0. As a SNiFF+ user (Windriver product) please consider the current implementation of this feature in this product as a reference. In SNiFF+ the tool to find and replace in one or multiple files is the Retriever. It's a windows divided in to main parts, in the left you specify what you are looking for (using regular expressions). The right part is also divided in two, in the top appears, grouped by file, the line in where there is a match. In the bottom there is an editor for the current selection on the top (so the Retriever includes the possibility to find and edit in one window). It includes also de possibility to replace all the matches. The tool take care of check out files (when working with a revision tool) if needed. SNiFF+ info: http://www.windriver.com/products/sniff_plus/index.html
*** Bug 44139 has been marked as a duplicate of this bug. ***
This pr is committed for 3.0
q. will this feature include RegExpressions? (ie. like https://bugs.eclipse.org/bugs/show_bug.cgi?id=14277 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=33115) basically, is this related to "Add regex content assist support for File search page" https://bugs.eclipse.org/bugs/show_bug.cgi?id=44280
Find/Replace already allows this and therefore this one will probably also do so (though not yet committed).
Global search is now possible. There's also a search button on the File search page in the Search Dialog. Replace using a regular expression is currently not yet supported (but you can use it for searching).
Marking this one as fixed, since we have other bugs outstanding issues: bug 37675 bug 47025
This should be reopened. Global search is possible, replace (*in one file at a time*) with regular expressions is possible, but this issue is different. It is still not possible (I'm using Eclipse version: 3.0.0 Build id: 200406251208) to perform a global replace on more than one file at a time. I think this could best be implemented by adding a "Scope" panel, like the one in the Ctrl-H Search dialogue, to the Ctrl-F Find/Replace dialogue - enabling replace to be carried out on the currently-open file / workspace / 'enclosing projects' / woking set.
I think this should be reopened (I can't do this - why?) because global search and replace lacks the possibilty to do a multiline search and replace, e.g. the possibility to replace one ore more lines of text with one or more lines of text. This should be doable by intializing the relevant org.eclipse.swt.widgets.Text input fields with SWT.MULTI instead of SWT.SINGLE The layout of the search and replace dialog should be no issue since there is enough space left. Example, where this is needed (to convince you that this feature request is no exotic hogwash): Part of my dayjob is to turn static html which our webdesigners created into dynamic jsp. Hereby I often have to replace one or two lines of identic html in multiple files (typically some place holder image or texts) with several more lines of jsp-code.
I agree that this should be reopened. Using Eclipse 3.1.0, I can't find any multi-file find and replace functionality. Although there is now a "replace..." button on the file search dialogue, I'm not sure what it does because there does not seem to be anywhere to specify the text to replace the matches with. I agree that the easiest way to provide this functionality would be through a scope option on the find/replace dialogue that included the option "all open files". A more powerful find/replace could perhaps also be provided via the search file dialogue. At the moment I have to use the file search to find the required files, then open them all individually in TextPad and use its find/replace functionality. Performing a manual find/replace across multiple files is also frustrating in Eclipse, because sometimes the text in the find/replace dialogue's "find" input box is automatically updated when changing file, so you have to type in the "find" text repeatedly or re-select it from the drop down list.
There are two ways to do a global replace (in 3.0): - Use the replace button on the search dialog: After searching you will get a new dialog to enter the replave string - Use 'Replace...' on search matches in the search view Please do not reopen bugs when you miss mutli-line search/replace, I filed a new bug for that (bug 77836).
I can't seem to include newline characters in the "With" field of the Replace dialog. Capture group characters works, but \n does not. For example, I would like to replace oldFunc(); with // oldFunc(); newFunc(); This example is trivial as I don't really need to use two lines. I can do... newFunc(); // oldFunc() But I have reason to want to replace with multiline regexps. Is this a bug?
(In reply to comment #18) > I can't seem to include newline characters in the "With" field of the Replace > dialog. Capture group characters works, but \n does not. For example, I would > like to replace > > oldFunc(); > > with > > // oldFunc(); > newFunc(); I'd like to see a solution to this too.. I need to be able to use regex on the "replace with" string as well.