Regex replace converts upper to lower case

General questions regarding the usage of CodeLite
etfb
CodeLite Curious
Posts: 2
Joined: Wed May 20, 2015 6:52 am
Genuine User: Yes
IDE Question: C++
Contact:

Regex replace converts upper to lower case

Post by etfb »

This is an odd one. At first, I couldn't use backreferences in my regexes because I didn't know they're not supported by the search and replace dialog, only by the "quick find bar" or whatever it's called. A search of this forum helped me work that out, though I don't understand the reason for the limitation.

But then I did this. I have the following lines:

USER FRED
USER BARNEY
USER Wilma99

Using the quick find bar, I search for "USER ([A-Z0-9]+)" and replace with "u_\1". And I get this:

u_fred
u_barney
u_wilma99

It converts the backreferenced text to all-lowercase! Two questions:

1. WTF???
2. How do I make it stop?
etfb
CodeLite Curious
Posts: 2
Joined: Wed May 20, 2015 6:52 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Regex replace converts upper to lower case

Post by etfb »

Hang on... just tried it again and it's working properly! It seems the "case sensitive match" button doesn't work immediately, but requires that you stop and restart the search. It's a very odd "feature", that...
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Regex replace converts upper to lower case

Post by eranif »

etfb wrote:This is an odd one. At first, I couldn't use backreferences in my regexes because I didn't know they're not supported by the search and replace dialog, only by the "quick find bar" or whatever it's called. A search of this forum helped me work that out, though I don't understand the reason for the limitation.
Simple: the quick-find-bar was developed _after_ the standard "Find and Replace" dialog with better capabilities.
etfb wrote:Hang on... just tried it again and it's working properly! It seems the "case sensitive match" button doesn't work immediately
It does. Its just that you dont see it immediately. When you click on the "Replace" button, it replaces the previous search (which was using a non-case search)
Now, when you click on the 'Case sensitive' button, it will affect the next 'Find' you click - this is why you think it does not affect immediately. IOW, when clicking on the 'Case sensitive' button it does not trigger a new search, instead it will be used on the next search

Eran
Make sure you have read the HOW TO POST thread
Post Reply