Mathematica Notebook has a Search&Replace dialog, which allows to look for particular expressions. But I'd like to be able to find instances of code corresponding to a particular pattern. E.g. if the pattern is x^_, I'd like to find all occurrences of things like x^2, x^(some*expression[352.34]) etc..

It seems that Search&Replace dialog doesn't have this option. How can I achieve this?

  • $\begingroup$ Wolfram Workbench can do this in a plain text package file (and also in notebooks but I don't know if it searches the notebook contents or the raw notebook expression). I always assumed that this is not easy because expressions typed in a notebook (or text editor) may not be complete or error-free. Are you looking to search only syntactically correct ones? That may be much easier to implement (even if the functionality is not there yet). $\endgroup$ – Szabolcs Nov 8 '16 at 16:38
  • $\begingroup$ @Szabolcs yes, I mainly need to do this with Mathematica output. I'm not quite in syntactically wrong code results. $\endgroup$ – Ruslan Nov 8 '16 at 16:40
  • 4
    $\begingroup$ Sorry, don't have time to compare it closely but it looks like at least closely related one: mathematica.stackexchange.com/q/27001/5478 $\endgroup$ – Kuba Nov 9 '16 at 1:31