# Searching within a project

## Search and replace within the current file

This feature lets you find and replace text within an editable file displayed in the editor. This feature is not available for read-only files such as:

* text files [uploaded from an external URL](/managing-projects-and-files/adding-files-to-a-project/adding-a-file-from-a-url.md), including files stored on Google Drive, and `.bib` files (reference libraries) imported from [Papers](/integrations-and-add-ons/reference-manager-integrations/papers.md), [Mendeley](/integrations-and-add-ons/reference-manager-integrations/mendeley.md), or [Zotero](/integrations-and-add-ons/reference-manager-integrations/zotero.md)
* text files that exceed 2 MB in size because the editor treats them as read-only

### How to access search and replace

To access search and replace, you can use a keyboard shortcut (Windows/Linux: **Ctrl+f**; Mac OS: **Cmd+f**), or select the **Toggle Search** icon located above the editor:

<figure><img src="/files/25MewNUhN96b8HbiHxNG" alt="Image showing location of file search" width="375"><figcaption></figcaption></figure>

Either method displays a search panel located at the bottom of the editor.

<figure><img src="/files/bmOaEwjKGRAjveG5Cnd6" alt="Image showing the location of the file search panel" width="375"><figcaption></figcaption></figure>

The search panel provides the following controls.

<figure><img src="/files/ctRmWWeptxKbGiCKJiUU" alt="Image showing controls provided on the file search panel" width="375"><figcaption></figcaption></figure>

### How to use search or search and replace

You can configure your search by selecting one or more of the following options, or proceed to search without selecting any.

* <img src="/files/C4EoJhEJs5SLZ8UaPcRR" alt="" data-size="line">: use a case-sensitive search
* <img src="/files/KRr54lOa3uVKxRPrFvsQ" alt="" data-size="line">: use regular expressions
* <img src="/files/z0kCp1XE2MI0Q2Edi8kt" alt="" data-size="line">: search for whole words only
* <img src="/files/iYIviB9QgC81uR7lc7gM" alt="" data-size="line">: search only within text highlighted in the editor

After selecting search options, type a search term in the box labeled **Search for**. Overleaf will start to search as you type and highlight the first successful result.

Use the next and previous buttons to find any additional search results.

![](/files/aMNMUO9dqcTOIdSSPDKv)

To replace the text of search results, enter the replacement text in **Replace with** and use one of the following methods:

* *Manual replacement*: select **Replace** to update an individual match and cause Overleaf to highlight the next match. Continue to navigate through the results using the previous/next buttons and click **Replace** to update additional matches.
* *Automatic replacement*: select **Replace All** to replace all matches at once in the selected file.

{% hint style="info" %}
Selecting the search button (<img src="/files/7W4hMiINmQKpDKVxAyMd" alt="" data-size="line">) switches to **project-wide search** which does not support Replace All functionality.
{% endhint %}

## Project-wide search

This feature allows you to search for text across all files in your project, provided they are under 2 MB. Files larger than 2 MB are excluded from the search results.

To access Project-wide search, you can use a keyboard shortcut (Windows/Linux: **Ctrl+Shift+f**; Mac OS: **Cmd+Shift+f**), or select the search icon above the file list.

![Image showing location of project-wide search icon](/files/GZuSYPYIfYaYorW5WsEJ)

You can also launch Project-wide search from within the project search panel by clicking the search button: <img src="/files/7W4hMiINmQKpDKVxAyMd" alt="" data-size="line">

Each of these methods displays a search box that temporarily hides the file tree.

![Image showing the project-wide search box](/files/4CGdjUT31FPoyTUSfgcW)

### How to use project-wide search

1. You can configure your search by selecting one or more of the following options, or proceed to search without selecting any.

![Image showing the controls to configure project-wide search](/files/SyjArqsvERbrxrLA1RfG)

* <img src="/files/C4EoJhEJs5SLZ8UaPcRR" alt="" data-size="line">: use a case-sensitive search
* <img src="/files/KRr54lOa3uVKxRPrFvsQ" alt="" data-size="line">: use regular expressions
* <img src="/files/z0kCp1XE2MI0Q2Edi8kt" alt="" data-size="line">: search for whole words only

2. Type your search term in the box provided and select the search icon (<img src="/files/IUdlL19c8b02EhzAHfKo" alt="" data-size="line">), or press return.
3. Any search results are listed and grouped by file.
4. Select a search result to jump to the corresponding file location.

### Video demonstrating project-wide search

The following video demonstrates project-wide searching using the Overleaf project [Typeset, the source code documentation for TeX, e-TeX, or pdfTeX](https://www.overleaf.com/latex/examples/typeset-the-source-code-documentation-for-tex-e-tex-or-pdftex/qkgfgyspnhcv). That project was selected because it contains large `.tex` files including `pdftex.tex`, which exceeds the 2 MB size limit and is excluded from the search results.

{% embed url="<https://videos.ctfassets.net/nrgyaltdicpt/21dsGfzi4yynX5beA2eBz3/4bd76333ece5ae522e09bb9745b8d6ca/NewSearch.mp4>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.overleaf.com/navigating-in-the-editor/searching-within-a-project.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
