Change to Sentence Case After Certain Character

A swapping-ground for Regular Expression syntax

Change to Sentence Case After Certain Character

Postby Mrrrr » Sat Feb 06, 2021 3:01 pm

Hello.

After searching for a couple of hours I could not find anything at least similar to what I am trying to do.
I tried various RegEx guides but since I'm a newbie I couldn't combine anything to work as intended, not even close.

I have been meaning to change something like:

Xxxxx, Yyyy Zzzzzzzz - Aaaaa Bbb Cccc Ddddd v2.0 {Eeeeee}.doc

to

Xxxxx, Yyyy Zzzzzzzz - Aaaaa bbb cccc ddddd v2.0 {eeeeee}.doc

In other words change to sentence case only after the "-" character.

Of course the words Xxxxx, Yyyy, Zzzzzzzz, Aaaaa, Bbb, Cccc, Ddddd, Eeeeee have various lengths.

I hope someone can help.

Thanks in advance.
Mrrrr
 
Posts: 2
Joined: Sat Feb 06, 2021 2:49 pm

Re: Change to Sentence Case After Certain Character

Postby Luuk » Sat Feb 06, 2021 3:43 pm

This you can do with a checkmark in "v2", then using a Match and Replace like...
(.+? - [A-Z])(.+)
$1\L$2

The \L is conducting "Lowercase" to everything after the very first " - [A-Z]".
Luuk
 
Posts: 690
Joined: Fri Feb 21, 2020 10:58 pm

Re: Change to Sentence Case After Certain Character

Postby Mrrrr » Sat Feb 06, 2021 4:49 pm

This is great, thank you very much!
Mrrrr
 
Posts: 2
Joined: Sat Feb 06, 2021 2:49 pm


Return to Regular Expressions


cron