Search and Replace¶
Sublime Text features two main types of search:
Both support regular expressions, a powerful tool for searching and replacing text.
Regular Expressions find complex patterns in text. To take full advantage of the search and replace facilities in Sublime Text, you should at least learn the basics of regular expressions. In this guide we won’t explain how to use regular expressions.
The term regular expression is usually shortened to regexp or regex.
This is how a regex might look:
To use regular expressions in Sublime Text, you first need to activate them in the various search panels. Otherwise, search terms will be interpreted literally.
Sublime Text uses the Perl Compatible Regular Expressions (PCRE) engine from the Boost library.
- 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.