Regex Replace with uppercase

I'm trying to do a regex search and replace where the replace changes the case of one of the parts.

So I have:
foo_bar
foo_baz

And I want:
fooBar
fooBaz

My search:
(foo)_(.)

My replace:
$1$2

Is there a way to transform $2 to uppercase during the replace?

Thanks,
Neil

2
2 comments

Hi there,

Is there a way to transform $2 to uppercase during the replace?


http://youtrack.jetbrains.com/issue/IDEA-70451

2

The issue above was implemented! You can transform $2 to uppercase by surrounding it with replacement syntax (reference):

\U$2\E

The \E is only needed if you have other text after $2 that you don't want uppercased.

2

Please sign in to leave a comment.