Capitalize first letter of the word following this string

A swapping-ground for Regular Expression syntax

Capitalize first letter of the word following this string

Postby Jack2 » Wed Nov 14, 2018 4:38 pm

Hi

I want to capitalise the first letter of the word that appears after the particular string SpaceHyphenSpace (" - ")

i.e. change from :
word1 word2 - word3 word4-word5
to:
word1 word2 - Word3 word4-word5

Word length varies. The position of the " - " varies.

I’m a regex noob - I seem to be able to do the “Find” part with
- [a-z]? or
- \b

but I can’t see how to do the Replace part

thanks
Jack2
 
Posts: 30
Joined: Wed Nov 14, 2018 4:32 pm

Re: Capitalize first letter of the word following this string

Postby Admin » Wed Nov 14, 2018 11:30 pm

Hi, I think you will need to use Javascript renaming in BRU for that.
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: Capitalize first letter of the word following this string

Postby Jack2 » Thu Nov 15, 2018 10:39 am

Hi - thanks for the reply.

Just to double check - I can only do that with the payware version, right? (I'm not a commercial user).

Javascript renaming is only available under a BRU commmercial licence...
Jack2
 
Posts: 30
Joined: Wed Nov 14, 2018 4:32 pm

Re: Capitalize first letter of the word following this string

Postby Admin » Thu Nov 15, 2018 10:43 am

Yes, a commercial license is needed for Javascript. With Javascript you would have a script that:
a) Searched for the first -
b) Capitalize the first letter after first - and space
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm


Return to Regular Expressions


cron