Sublime Forum

Find and Replace with Upper- & Lowercase handling

#1

Hello,

I’m not sure if a feature like this may already exist…

I’d like to find and replace words without doing it multiple time for words which are uppercase / lowercase. The replace feature should detect if the first letter is uppercase and then will automatically replace it with uppercase or lowercase if it was lowercase before.

For example in the following sentence I would like to replace the word ipsum to lorem:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod. Lorem Ipsum dolor sit Amet

Expected result:
Lorem lorem dolor sit amet, consectetur adipisicing elit, sed do eiusmod. Lorem Lorem dolor sit Amet

I know this is possible with doing it in two steps using the case sensitive feature. But I’m searching for a way doing this in one step. Because i use this very often.

0 Likes

#2

Have you tried the “preserve case” button?

1 Like

#3

seems like you can just ensure that Preserve Case is enabled
:

It’s the button under the .* in the bottom left of the panel

3 Likes

#4

Exactly what I was looking for! Thanks a lot!

0 Likes

#5

Is that new / on the dev build?

I don’t have that option : [

 
Might be cool to make a plugin that handles all case variations though (camel, snake, etc.)

0 Likes

#6

I don’t think it’s a new thing; the oldest version of Sublime 3 that I have handy is 3103 and it’s there, and it also appears in Sublime Text 2.

Note however that it’s only in the Replace panel and not the Find in Files panel (curiously).

0 Likes

#7

Ok I see it in the Replace panel, I was checking @ Find in Files initially.

0 Likes