Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The warning on find and replace isn't explicit and I only found out after an almost harmless global change that I really was replacing ALL, not just all instance in my selection (which is where most other applications would automatically limit scope)

Is there any way to limit the scope of "Replace All" to selected text only?

share|improve this question
Why would "Replace All" not replace everything? Have you tried other options such as "Replace" or "Replace & Find"? I don't think most applications work this way; only some classic editors (vim, emacs) and some good modern IDEs do. Unfortunately, Mathematica's front-end is neither a proper editor nor an IDE... – R. M. Mar 17 '14 at 14:09
@rm-rf Thanks for the reply. Admittedly perception may differ, and I would agree that replace and replace & find have their place, but they can be unwieldy and error prone if there are many but not all instance to change. Example: renaming local variables within their scope without affecting local variables with the same names elsewhere (because although it should be OK functionally, label names may also have meaning in context) or changing text without affecting code. I'm happy that others may be comfortable with all = ALL, I just wonder if I could have some cake as well ;) – Julian Moore Mar 17 '14 at 14:50
I understand what you're asking and I didn't say it was unreasonable... it's just my opinion that the front-end is neither an editor nor an IDE (if it is, it sucks at both), so many useful features like this are missing. Halirutan's Mathematica plugin for IntelliJ IDEA is a much more advanced editor/IDE than the FrontEnd or the Workbench and allows you to make variable changes local to a module/block/with. However, it's a work in progress, so some features like debugging/testing, etc. are missing as of now. – R. M. Mar 17 '14 at 14:56
@rm-rf I've just had a quick look at Halirutan's plug-in - definitely warrants careful consideration - I just don't know where my optimimum setup complexity/ease-of-use balance point is: I suppose I'll have to find out! Thx. – Julian Moore Mar 17 '14 at 17:38
I fully understand where you're coming from... I'm learning two different languages now and I too spent my first month just on getting the "optimal setup" — time that could've been better spent on learning the language! Of course, now that I know a bit more, I've found that someone else's optimal setup (that I cribbed from the net) is not optimal for me. I think it's only human to want to optimize these little things at the very start when it's perhaps better to do so later... :) In any case, this answer might be helpful. – R. M. Mar 17 '14 at 17:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.