Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 2 - Find and Replace: "case-sensitive" vs "preserve case"?

Tags:

sublimetext2

In the Find/Replace dialog, what is the difference between the options "case-sensitive" and "preserve case"?

like image 378
Himanshu P Avatar asked Mar 20 '13 18:03

Himanshu P


Video Answer


1 Answers

The Case sensitive option determines what will be matched. The Preserve case option determines if the matched text's case is preserved or not when replacing it with the replacement string.

Here's an example which should make this clear. Imagine you have this:

word
Word

If Case sensitive is not selected and you look for word, text from both lines will be selected. If it is selected, only the first, lowercase word will be matched.

Let's say we're using tapioca as the replacement string. If Preserve case is not selected (and Case sensitive isn't either), a Replace All would give you the following result:

tapioca
tapioca

With Preserve case enabled, it would instead become:

tapioca
Tapioca

i.e., the second Word's case would be preserved and "applied" to the replacement string.

like image 81
Greg Sadetsky Avatar answered Sep 29 '22 15:09

Greg Sadetsky