Home Download Buy Blog Forum Support

Regex find and replace causes random letter case change

Regex find and replace causes random letter case change

Postby fidodo on Tue Oct 30, 2012 11:58 pm

Sometimes when I run a regex find and replace I get random letters changing case. For example I ran this regex:

Code: Select all
(\w+\.\w+\.\w+) = class \w+ extends (\w+)


and this replace:

Code: Select all
class $1 extends $2


And it converts:

Code: Select all
Project.Models.Opinion = class Opinion extends Project.Model


to

Code: Select all
Class Project.MOdeLs.opinion exTenDs project.Model


I'm running version 2.0.1 build 2217 on linux.
fidodo
 
Posts: 2
Joined: Tue Oct 30, 2012 11:54 pm

Re: Regex find and replace causes random letter case change

Postby adzenith on Wed Oct 31, 2012 3:01 am

Try unsetting the "Preserve Case" option in your find panel.
adzenith
 
Posts: 1213
Joined: Mon Oct 19, 2009 9:12 pm

Re: Regex find and replace causes random letter case change

Postby fidodo on Fri Nov 02, 2012 12:16 am

Thanks that works! Do you know why I was getting such odd results with preserve case on? Also, what does preserve case specifically does? The case is still preserved with it off so i'm not sure what effect it has.
fidodo
 
Posts: 2
Joined: Tue Oct 30, 2012 11:54 pm

Re: Regex find and replace causes random letter case change

Postby adzenith on Fri Nov 02, 2012 4:48 pm

No, I actually have no idea how it works... I think it's mostly for when you do a case-insensitive find+replace, so if you search for foo and replace with bar, it'll change foo to bar and Foo to Bar or something.
adzenith
 
Posts: 1213
Joined: Mon Oct 19, 2009 9:12 pm


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], memomo and 24 guests