Having trouble performing Regex Uppercase transformation

Hi there,
Been learning regex on regex101.com and implementing some basic ones in KM. When I want to perform an uppercase transformation, what I've been trying is using regex101.com to figure out what regex will highlight the desired text, and then in KM using the search and replace function to enter "and replace with: \U"
Not working and after a fair amount of searching, not sure what I'm doing wrong. If anyone can help, please let me know.

Cheers!

It would help to see your regex and some sample content

1 Like

See this tip/article as it has some useful crossreferences

1 Like

Here's a screen capture. Taking chord/lyric charts for acoustic songs online and converting them to the more succinct format I use. This macro performs a sequence of mostly simple changes. I can provide screenshots of any of the other parts if that ends up being useful. The part of the formatting I'm working on is that all the lyrics are to be lower case and all the chords to be capitalized. So I start by converting everything to lower case, and then have come up with and tested a regex to find all the chord names. Just need to be able to re-capitalize them. It looks like this is easy to do in KM if you're doing it to the whole clipboard using Filter Clipboard, but to do it to targeted parts only via regex is what's stumping me at the moment.

The screenshot certainly helps, but it would be much easier for us to test and help if you had provided some sample content and uploaded the macro itself. That said, it looks like the problem is twofold: you aren't searching with regex, and you aren't including the match result in the replacement. Right now, that search action is configured like this:

when it should be configured like this:

The \0 after \U is what tells the regex to apply the transformation to the entire match.

2 Likes

In case anyone reading this is not using KM9, you should be aware this feature was added in KM9:
Text Case Conversions -- New in KM9

3 Likes

Thank you! For both your help and being patient with my newness!
Working now!

1 Like