Zettlr LogoZettlr Documentation
Setup
Troubleshooting
FAQ
  • About Zettlr
  • Download Zettlr
  • GitHub
  • English
  • Español
  • Deutsch
  • Français
  • Italiano
  • 日本語
  • Português
  • Русский
Setup
Troubleshooting
FAQ
  • About Zettlr
  • Download Zettlr
  • GitHub
  • English
  • Español
  • Deutsch
  • Français
  • Italiano
  • 日本語
  • Português
  • Русский
  • Welcome
  • Getting started

    • Setup
    • Migrating from Obsidian
    • Migrating to a New Computer
    • Installing LaTeX
    • A Note on Security
    • Get involved
    • Troubleshooting
  • First Time Users

    • First Steps
    • Workspaces
    • Creating Files and Folders
    • Writing Markdown
    • Importing Word- and other Documents into Zettlr
    • Exporting Files
  • Interface

    • File Manager
      • Workspaces and Root Files
      • Choosing Which Files To Display
      • File Manager Appearance (Modes)
      • The File List
      • Properties
      • Filtering
      • Global Search
      • Projects
    • Split View
      • Document Tab Bar
      • Markdown Editor
      • Code Editor
      • Image Viewer
      • PDF Viewer
    • Sidebar
      • Table of Contents
      • References
      • Related Files
      • Other Files
  • Writing

    • Markdown Editor
      • Markdown Compendium
      • Appearance
      • Search
      • Autocomplete
      • Footnotes
      • Citations
      • Working With Comments
      • Status Bar
      • Table Editor
      • Text Transforms
      • Snippets
      • YAML Front Matter
    • Language & Style
      • Spellchecking
      • LanguageTool
      • Markdown Syntax
      • Autocorrect and Magic Quotes
      • Readability
    • Scientific & Technical
      • Math
      • Code Blocks
      • Mermaid Diagrams
      • Pomodoro Timer
      • Writing Statistics
    • Exporting
      • Exporting Workflow
      • Defaults Files (Profiles)
      • Selecting the PDF Engine
      • Assets Manager
      • Custom Templates and Reference Documents
      • Custom Commands
      • Printing and Previewing
      • Lua Filters
    • PKMS & Zettelkasten
      • The Zettelkasten method
      • Graph View
      • Tag Manager
  • Guides
    • Custom CSS
    • Reference Manager Integration
    • Setting up LanguageTool locally
    • Presentations
    • Submitting to a Journal using a LaTeX Template
    • Zettlr as a Portable App
  • Reference
    • Keyboard Shortcuts
    • Settings
    • Frequently Asked Questions

Search

Search

You can quickly search through the contents of your current document by pressing Cmd/Ctrl+F. This will open up the editor search panel.

editor_search_panel.png

Tip

If you need to search several files simultaneously, use the global full-text search instead.

Searching for Terms

To start a search, simply start typing. The editor will immediately start the search and highlight all matches for you. Press Enter to select the first match after your cursor position. Continue to press Enter to move through the search results. Press Shift+Enter to cycle backwards through the results. You can also use the “next” and “previous” buttons.

Click “all” to select all matches at once.

Note

There is a difference between "highlighting" and "selecting" search results. By default, your search results are only highlighted, meaning that the editor shows you where they are. But if you start typing, nothing will change. Once you select a result, though, you will overwrite it. Selecting "all" matches effectively means that you can start writing to replace all matches at the same time.

By default, the search will be case-insensitive (so that the term “search” will highlight any occurrence of “search,”“Search,” or “SeArCh”). To ensure that it only matches the exact term, enable “match case.”

Furthermore, the search will also match partial words, so a search for “match” will highlight both “match” and the first part of “matches.” Enabling “by word” ensures that only exact matches are highlighted (“match” but not “matches”).

Replacing Search Results

Besides highlighting search results, you can also use the panel to replace the search results with something else. Focus the “Replace” text field to start replacing. You can leave the field empty to remove all results. Once you press Enter, this will select the next match. Only when you press Enter while a match is selected will it perform the replacement.

You can also click the “replace” button. If you click “replace all,” this will immediately replace all matches with whatever is in the “Replace” text field.

Regular Expressions (regexp)

By default, all your searches are quite literal. The editor will work with what literally looks like your search term. However, you can also peruse regular expressions to search and replace.

The editor search supports JavaScript Regular Expression syntax. Learn more about JavaScript regular expressions here.

To make the editor interpret your query not literally, but as a regular expression, check the “regexp” checkbox. Now, it will perform regular pattern matching instead of exact matching. This means that, instead of searching for individual occurrences, you can search for patterns (e.g., you can search for four digits instead of individual years).

Info

If you are already familiar with JavaScript regular expressions, you may know that these are usually written within forward-slashes, e.g.: /\d{4}/. For using the regular expression search in the editor, leave off these forward slashes, otherwise you will yield unexpected results.

Some examples of regular expressions to give you an impression of how they work:

  • \d{4}: Searches for four consecutive digits
  • ^#{2}\s(.+): Matches headings level 2. In addition, it contains a “capturing group” that matches the heading content.

Replacing with Regular Expressions

That latter example already hints at the power of regexp searches. It contains a “capturing” group.

When you perform replacement with regular expressions, you can replace just as you have seen with simple searches (for example, you could replace all four digit-strings with “YYYY”). But when you activate Regular Expressions, you can also use capturing groups within the Replace field! To do so, simply provide the number of the capturing group with a leading dollar-sign (the first capturing group is $1, the second is $2, and so on).

A concrete example: To convert all headings level 2 in the current document into headings level 1, you can use the following search- and replace strings while the “regexp” option is enabled (see also the screenshot):

  • Search for: ^#{2}\s(.+)
  • Replace with: # $1

editor_search_regexp.png

Edit on GitHub
Last update: 8/18/26, 8:15 PM
Contributors: Hendrik Erz
Prev
Appearance
Next
Autocomplete
© 2017-2026 by Zettlr and Contributors