Regular expression question

I know this isn't an EAP question, but can't seem to
figure this out. Within IDEA, how would I do a
regex "search and replace" to change the case of a
letter? I've used the S&R dialog with regex checked,
and for example, specified "[a-z]" as the search
pattern, but I haven't been able to figure out the
replacement pattern to uppercase any matches.

I notice that this isn't supported as a replacement
pattern in java.util.regex. Is this supported in IDEA?
If so, what would the replacement pattern be? I've
tried "\u$0", "
u$0", etc., etc., etc.

Any help would be appreciated.

Eric

0
3 comments

IDEA supports only whatever java.util.regex supports. Unfortunately, it looks like there's no easy way to do what you want.

0

You could do this in two steps (actually 27 steps). First search for the
lowercase letters and replace each one with some unusual pattern like:
Search: ()
Replace: **$1**
Then for each letter, replace **a** with **A**, etc.
Of course, this is tedious, which is why Perl and Ruby would be better
choices to do this kind of thing. But sometimes this technique can be a
useful trick.

--
Rob Harwood
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0

You sure have some creativity ;)

0

Please sign in to leave a comment.