Search and Replace


Development of Sublime Text has moved on to version 3.

As a result, this branch for Sublime Text 2 will not be updated any more. Please select the latest branch in the panel on the bottom left and consider updating Sublime Text.

Sublime Text features two main types of search:

We’ll examine them in turn, but let’s talk about a powerful tool for searching text first: regular expressions.

Regular Expressions

Regular Expressions find complex patterns in text. To take full advantage of the search and replace facilities in Sublime Text, you should learn at least the basics of regular expressions. In this guide we will not explain how to use regular expressions.

Typing out regular expression gets boring fast, and saying it actually is even more annoying, so instead nerds usually shorten that to regexp or regex.

This is how a regex might look like:


To use regular expressions, you need to activate them first in the various search panels. Othwerwise, the search term will be interpreted literally.

Sublime Text uses Perl Regular Expression Syntax from the Boost library.

See also

Boost library documentation for regular expressions
Documentation on regular expressions.
Boost library documentation for format strings
Documentation on format strings. Note that Sublime Text additionally interprets \n as $n.