Sublime Forum

Strange capitalization on RE find and replace

#1

Hi,

New to ST.

I am seeing some strange behavior doing a regex find and replace. I am perfectly willing to believe I’m doing something wrong, I just can’t tell what it is. Or have I found a bug?

I’m using ST 3 beta, on Windows, build 3065.

Here’s a simple example:

Buffer:

Abc Defghi

Find what (accessed w/ Ctrl-h):

([A-Z][a-z]) ([A-Z][a-z])

Replace with:

$2 $1

When I execute (with Ctrl-Alt-Enter), I expect this:

Defghi Abc

but what I get is:

DefgHi abc

I’m not clear if the replacements are specified as $1, $2, … or as \1, \2, …, but it appears to be the same result either way. If I do this search in another text editor supporting RE’s, I get the expected behavior.

Can anyone tell me what I am doing wrong?

Thanks

0 Likes

#2

Tested and worked as expected

You may want to open your console

and turn on logging

and test it again, see if there are any commands that are unexpected, that are possibly from a plugin

0 Likes

#3

Problem solved. User error on my part. Thanks for your help.

It’s a feature, not a bug. I had inadvertently turned on Preserve Case.

Of course, now I want to know if I could customize the icons in the find and replace panel, to make the on state be thinly outlined in red, but that is an investigation that will have to wait for another day.

Thanks again for your help.

0 Likes

#4

:smile:

0 Likes