I would love to be able to use the power of Mathematica's patterns to find and replace within my code. I have searched for this on google, and so far I've come up with this: http://reference.wolfram.com/workbench/index.jsp?topic=/com.wolfram.eclipse.help/html/tasks/patterns/findreplace.html
Which seems to suggest that I would need another program, Mathematica Workbench, to do so? Can anyone explain what this is to me? I guess this would involve paying some money to Wolfram
I also had a go with the code written in this thread. It seems to work part of the time, but has some undesirable features (or at least, undesirable to me!).
I want to replace all instances of k[i_]
with Subscript[k,i]
in my code (and I'm sure I would use this for more complex things later on too if I can get it to work now). Here are the current problems that I have, when I run NBReplace[k[i_ ], Subscript[k,i]]
*) Not all cases of k[_]
are covered in my code. I can't see why this would be. I don't understand the code for the function in detail, but it looks to me like it should cover all cases
*) The code currently replaces k[_]
with k\_Subscript\_i
. I guess maybe I need to change an 'InputForm' somewhere to something else? Or I need to get rid of the code that's changing things to be strings?
*) The code replaces the k[_]
in the function call itself, how can I make an exception for this cell?
Any help would be greatly appreciated
InputForm
inside theNotebookWrite
call toStandardForm
. Also, please use code blocks for your code, not $\LaTeX$ markup. $\endgroup$ – Oleksandr R. May 22 '16 at 1:49NBReplace
that specifies the notebook, rather than usingSelectedNotebook[]
to operate on the current one. $\endgroup$ – Oleksandr R. May 22 '16 at 1:58