({{, (RefLink[NotebookFind, paclet:ref/NotebookFind])[obj,data]
sets the current selection in the specified notebook object to be the next occurrence of data. }, {, (RefLink[NotebookFind, paclet:ref/NotebookFind])[obj,data,Previous]
sets the current selection to be the previous occurrence. }, {, (RefLink[NotebookFind, paclet:ref/NotebookFind])[obj,data,(RefLink[All, paclet:ref/All])]
sets the current selection to be all occurrences. }, {, (RefLink[NotebookFind, paclet:ref/NotebookFind])[obj,data,dir,elems]
sets the current selection to be the occurrence in the direction dir and searches the elements of cells specified by elems. }})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[NotebookFind, paclet:ref/NotebookFind]) returns (RefLink[$Failed, paclet:ref/$Failed]) if the search it performs finds no occurrence of data.

obj may be a (RefLink[NotebookObject, paclet:ref/NotebookObject]) or a (RefLink[CellObject, paclet:ref/CellObject]). If obj is a (RefLink[NotebookObject, paclet:ref/NotebookObject]), then the find operation starts where the selection is in the notebook.

data can be a string, box expression, or a complete cell.

Possible values of dir include Next, Previous, and (RefLink[All, paclet:ref/All]).

The possible elements are:

The default for elems is CellContents. Only the contents of boxes, not their styles or options, are included in the search.

The following options can be given:

The front end will highlight the region corresponding to the result.

OpenersPrimaryExamplesSection(Spacer1)Examples  (5)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Create a notebook:

nb=CreateWindow[DocumentNotebook[{TextCell["fat cat","Text",CellTags->{"L1"}],TextCell["on my hat","Text",CellTags->{"L2"}]}]];

Find an occurrence of the letters "at":

NotebookFind[nb,"at"];

OpenersExampleSection1(Spacer1)Scope  (2)

Create a notebook:

nb=CreateWindow[DocumentNotebook[{TextCell["fat cat","Text",CellTags->{"L1"}],TextCell["on my hat","Text",CellTags->{"L2"}]}]];

Find an occurrence of the letters "at":

NotebookFind[nb,"at"];

Find the next occurrence:

NotebookFind[nb,"at"];

Select all cells that contain "at":

NotebookFind[nb,"at",All];

Find the last "at" in the document:

SelectionMove[nb,After,Notebook];NotebookFind[nb,"at",Previous];

Go back to find a cell with "L1" in its cell tags:

NotebookFind[nb,"L1",Previous,CellTags];

Find all Input-styled cells in this notebook:

NotebookFind[EvaluationNotebook[],"Input",All,CellStyle]

OpenersExampleSection2(Spacer1)Options  (2)

OpenersExampleSubsection0(Spacer1)AutoScroll  (1)

Normally, the document scrolls so that the found data is visible in the notebook window:

nb=NotebookPut[Notebook[Table[Cell[ToString[i],"Text"],{i,50}]]];
NotebookFind[nb,30];

With (RefLink[AutoScroll, paclet:ref/AutoScroll]) set to (RefLink[False, paclet:ref/False]), the document does not scroll to the found data:

SelectionMove[nb,Before,Notebook];
NotebookFind[nb,30,AutoScroll->False];

OpenersExampleSubsection1(Spacer1)IgnoreCase  (1)

By default, searches are case sensitive:

nb=CreateDocument[{"Better and better!"}];

NotebookFind[nb,"better"];

A case-insensitive search:

SelectionMove[nb,Before,Notebook];NotebookFind[nb,"better",IgnoreCase->True];

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Cells, paclet:ref/Cells])  ▪  (RefLink[NotebookLocate, paclet:ref/NotebookLocate])  ▪  (RefLink[SelectionMove, paclet:ref/SelectionMove])  ▪  (RefLink[NotebookOpen, paclet:ref/NotebookOpen])  ▪  (RefLink[Find, paclet:ref/Find])  ▪  (RefLink[FindSettings, paclet:ref/FindSettings])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Notebooks from the Kernel, paclet:tutorial/ManipulatingNotebooksFromTheKernel])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Low-Level Notebook Programming, paclet:guide/LowLevelNotebookProgramming])}, {▪(RefLinkPlain[Palettes, paclet:guide/Palettes])}})}})