Regex Convert to Uppercase

Post your questions and help other users.

Moderator: Martin

Post Reply
98b427af

Regex Convert to Uppercase

Post by 98b427af » 02 Apr 2014 23:11

What's the Automatic regex syntax for converting lowercase to uppercase? For example I expect:

replaceAll("two words", '\\b([a-z])', '\U$1')

To produce "Two Words" but it doesn't.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Regex Convert to Uppercase

Post by Martin » 04 Apr 2014 09:43

To my knowledge the built-in regex support of Java (used by Automagic) does not have a way to directly convert the case within a replacement pattern.
You might need to split the string manually and use function toUpperCase and toLowerCase on the characters you want to convert.

Post Reply