# Is there a way to search for a WolframLanguage pattern in Notebook? [duplicate]

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?

• 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). – Szabolcs Nov 8 '16 at 16:38
• @Szabolcs yes, I mainly need to do this with Mathematica output. I'm not quite in syntactically wrong code results. – Ruslan Nov 8 '16 at 16:40
• Sorry, don't have time to compare it closely but it looks like at least closely related one: mathematica.stackexchange.com/q/27001/5478 – Kuba Nov 9 '16 at 1:31