In any text editor Find and Replace can be an incredibly useful function. Find and Replace can be useful in a range of scenarios; for example, if you want to change the name of a variable in your code or fix all instances of a common typo.
To use Find and Replace in Sublime Text 3, you can either click “Find” in the top-bar, then select “Replace” from the list, or you can press the keyboard shortcut Ctrl+H – the same way it works in, for example, Microsoft Office Word. A Find and Replace toolbar will appear at the bottom of the window, in it, there will be two text boxes, labelled “Find” and “Replace” respectively.
To the right of the Find and Replace text boxes are four buttons. “Find” will search through the current document for the next instance of the text in the “Find” box. “Find All” will highlight all instances of the text in the “Find” box.
“Replace” will replace the currently highlighted instance of the text in the “Find” box with the text in the “Replace” box; alternatively, it will highlight the next instance of the text in “Find” if one is not currently selected. “Replace All” will replace all instances of the text in the “Find” box with the text in the “Replace” box.
There are seven boxes on the left of the “Find” and “Replace” text boxes that can be used to apply further settings. “Regular expression” allows you to specify the “Find” text with regex, allowing for a very powerful matching system. “Case sensitive” restricts the matching of the “Find” term to only match when the cases match. “Whole word” only matches the text in the “Find” box if complete words are selected.
“Wrap” which is enabled by default, wraps round to the start of the document when it reaches the end. “In selection” allows you to specify a section of text which should be checked for matches. “Preserve case”, keeps the current casing, even if the replacement text is or is not capitalized. “Highlight matches” which is also enabled by default, marks all matches in the document without actually selecting them as a visual aid.