Function Repository Resource:

FindInOpenNotebooks

Source Notebook

Search for words in all open notebooks

Contributed by: W Craig Carter

ResourceFunction["FindInOpenNotebooks"]["query"]

opens an interface for finding instances of "query" in all open notebooks.

Details and Options

All open notebooks are searched, including the Messages window.
An instance of the search string will always be found in the evaluation notebook.
All cells are searched: strings that appear in compressed data, audio data and image data will trigger a match. Short search strings may give a large number of instances.
The following options can be given:
IgnoreCaseTruewhether to treat uppercase and lower case the same
"IgnoreCells"{"Output"}cells in this list will not appear in searches
"MinimumStringLength"2queries must be longer than this value

Examples

Basic Examples (5) 

Create some example open windows:

In[1]:=
nb = CreateDocument[
   {
    TextCell["Alice goes down a rabbit-hole", "Section"],
    TextCell["rabbit hole rabbit", "Input"],
    ExpressionCell[rabbit  hole rabbit, "Output"],
    TextCell[
     ExampleData[{"Text", "AliceInWonderland"}],
     "Text"
     ]
    },
   WindowTitle -> "AliceInWonderland"
   ];
NotebookFind[nb, "hole", WrapAround -> True];
SelectionEvaluate[nb];
In[2]:=
CreateDocument[
  TextCell[
   StringTake[ExampleData[{"Text", "OriginOfSpecies"}], 100000],
   "Text"
   ],
  WindowTitle -> "OriginOfSpecies"
  ];

Look for "rabbit" in all open notebooks, ignoring cases:

In[3]:=
ResourceFunction["FindInOpenNotebooks"]["rabbit"]
Out[3]=

Look for "Rabbit" in all open notebooks, not ignoring cases:

In[4]:=
ResourceFunction["FindInOpenNotebooks"]["Rabbit", IgnoreCase -> False];

Options (6) 

IgnoreCase (2) 

This will look for Rabbit and not rabbit or RABBIT:

In[5]:=
ResourceFunction["FindInOpenNotebooks"]["Rabbit", IgnoreCase -> False];

"IgnoreCells" (2) 

This will exclude Text cells:

In[6]:=
ResourceFunction["FindInOpenNotebooks"]["Rabbit", IgnoreCase -> True, "IgnoreCells" -> {"Text"}];

"MinimumStringLength" (2) 

Compressed data in a notebook can create undesired matches:

In[7]:=
CreateDocument[TextCell[Compress[Range[10^4]], "Text"], WindowTitle -> "Compressed Data"]
Out[7]=
In[8]:=
ResourceFunction["FindInOpenNotebooks"]["Doc", "MinimumStringLength" -> 2]
Out[8]=

Use the "MinimumStringLength" option to only search for strings over a given length:

In[9]:=
ResourceFunction["FindInOpenNotebooks"]["Doc", "MinimumStringLength" -> 4]

Publisher

W Craig Carter

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 20 June 2025

Related Resources

Author Notes

The formatting isn't perfect and may not be aesthetic. I'd like to dynamically highlight which instance is currently selected. The returned number of notebooks and instances should probably be limited. I should probably not dive into data structures in the searches, or have this as a rarely used option.

License Information