[Eric] Suggestion for search and replace

Al Dunstan adunstan at omi.com
Thu Jan 5 14:48:00 GMT 2012


On Thursday, January 05, 2012, Leonardo Giordani wrote:
> Sometimes when replacing with regular expressions (especially with
> groups) I'm not totally sure that my substitution will be correct.
> 
> With the current search and replace there is no easy way to know if it
> went good since when hitting the replace button the selection jumps
> immediately to the next match.
> Even stopping the replace means that you have to search backwards the
> last substitution, which is not simple if it went bad.
> 
> Could it be possible to preview the line as it will be after the
> substitution? I mean something like copying the line in a temporary
> buffer, perform the substitution on it and show above the current line,
> with a colored background.
> 
> Thank you,
> 
> Leo
> _______________________________________________
> Eric mailing list
> Eric at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/eric

Eclipse uses separate "Replace", "Replace/Find" and "Find" buttons.  If you 
think it's going to do what you want just keep hitting "Replace/Find" but if 
you're not sure hit "Replace" and inspect the changes, then hit "Find" to 
advance to the next or hit "Quit" and undo the damage.

That might be easier than messing around with previews...

-- 
Al Dunstan, Software Engineer
OptiMetrics, Inc.
3115 Professional Drive
Ann Arbor, MI  48104-5131

"There are two ways of constructing a software design.  One way is to
make it so simple that there are obviously no deficiencies.  And the
other way is to make it so complicated that there are no obvious
deficiencies."
            - C. A. R. Hoare


More information about the Eric mailing list