This question already has an answer here:

Currently I am stuck with the issue of renaming an instanced variable like r1$23314 to a global one.

This issue arises as I need to use a "localizeAll" Module in a Module/Block itself. Here's a link.

In particular I would like to rename this custom-made function's parameters.

b5[r1, r2, z] //. {Names["r1$*"][[2]] -> r1}

Sadly the output is still:

$ \scriptsize \left( \begin{array}{c} 1. \text{r1$\$$295581} \\ \normalsize \frac{\text{r1$\$$295581} (1. \text{r1$\$$295581}+1. \text{r2$\$$295581})}{1. \text{r1$\$$295581}+2. \text{r2$\$$295581}} \\ \normalsize \frac{\text{r1$\$$295581} (1. \text{r1$\$$295581}+1. \text{r2$\$$295581})}{1. \text{r1$\$$295581}+0.946259 \text{r2$\$$295581}} \\ \end{array} \right) $

Thank you.


marked as duplicate by Kuba, Karsten 7., bbgodfrey, Dr. belisarius, Bob Hanlon Apr 24 '15 at 15:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ ToExpression@StringDelete[ToString@r1$23123, "$"]? $\endgroup$ – Algohi Apr 24 '15 at 6:17
  • $\begingroup$ that and more in Pattern matching multiple symbols names and powers $\endgroup$ – Kuba Apr 24 '15 at 8:50
  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – bbgodfrey Apr 24 '15 at 11:50
  • $\begingroup$ @Algohi: How exactly do I use ToExpression@StringDelete[ToString@r123123,""] ? As for duplicates, symbol handling is not just a pattern-matching in my case. $\endgroup$ – chrisoutwright Apr 27 '15 at 17:33
  • $\begingroup$ @chrisoutwright use "$" instate of " " $\endgroup$ – Algohi Apr 27 '15 at 17:39

Browse other questions tagged or ask your own question.