Find
✖
Find
Details and Options

- Find breaks the input stream into records, delimited by record separators, and scans each record for the strings you specify.
- Find returns as a string the first record which contains the specified text.
- If Find does not find any record which contains the specified text before it reaches the end of the file, it returns EndOfFile.
- The following options can be given:
-
AnchoredSearch False whether to require that the text searched for be at the beginning of a record IgnoreCase False whether to treat lowercase and uppercase letters as equivalent RecordSeparators {"\r\n", "\n","\r"} separators for records WordSearch False whether to require that the text searched for appear as a word WordSeparators {" ","∖t"} separators for words - The first argument to Find can be InputStream["name",n], or simply "name" if there is only one open input stream with the specified name.
- You can open a file or pipe to get an InputStream object using OpenRead.
- Find does not close streams after it finishes reading from them.
Examples
Basic Examples (2)Summary of the most common use cases
In[1]:=1

✖
https://wolfram.com/xid/0obdq-7nyqmx
Out[1]=1

Get the first line that contains "electors":
In[2]:=2

✖
https://wolfram.com/xid/0obdq-gbtqn6
Out[2]=2

Find the next line that contains "electors":
In[3]:=3

✖
https://wolfram.com/xid/0obdq-g09x1
Out[3]=3

In[4]:=4

✖
https://wolfram.com/xid/0obdq-jfb56u
Out[4]=4

In[1]:=1

✖
https://wolfram.com/xid/0obdq-w5wsjw
Out[1]=1

Find the first line that contains "electors" or "people":
In[2]:=2

✖
https://wolfram.com/xid/0obdq-6rl1jq
Out[2]=2

In[3]:=3

✖
https://wolfram.com/xid/0obdq-tf52cz
Out[3]=3

Wolfram Research (1991), Find, Wolfram Language function, https://reference.wolfram.com/language/ref/Find.html.
✖
Wolfram Research (1991), Find, Wolfram Language function, https://reference.wolfram.com/language/ref/Find.html.
Text
Wolfram Research (1991), Find, Wolfram Language function, https://reference.wolfram.com/language/ref/Find.html.
✖
Wolfram Research (1991), Find, Wolfram Language function, https://reference.wolfram.com/language/ref/Find.html.
CMS
Wolfram Language. 1991. "Find." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Find.html.
✖
Wolfram Language. 1991. "Find." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Find.html.
APA
Wolfram Language. (1991). Find. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Find.html
✖
Wolfram Language. (1991). Find. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Find.html
BibTeX
✖
@misc{reference.wolfram_2025_find, author="Wolfram Research", title="{Find}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/Find.html}", note=[Accessed: 08-March-2025
]}
BibLaTeX
✖
@online{reference.wolfram_2025_find, organization={Wolfram Research}, title={Find}, year={1991}, url={https://reference.wolfram.com/language/ref/Find.html}, note=[Accessed: 08-March-2025
]}