Alteryx REGEX upper first letter of every sentence and lower case for the rest

329 Views Asked by At

I'm trying to transform strings in Alteryx using one regex tool as follows

Original:

lorem ipsum. DOLOR SIT AMET. 

Looking for:

Lorem ipsum. Dolor sit amet.

Now, I did manage to match this pattern with the following REGEX

(^\w)|\.\s(\w)

But I'm not sure how to replace it in Alteryx.

Any ideas? I expected \U$1\U$2 and copy unmatched to work.

1

There are 1 best solutions below

0
On BEST ANSWER

Could you please try following, written with your shown samples. This is creating 4th capturing groups, where 1st capturing will have like: D, 2nd capturing group contains OLOR, 3rd capturing group contains SIT and 4th capturing group contains AMET in shown samples.

^.*?\.\s+(.)(.*?)\s+(.*?)\s+([^.]*)\.$

Online demo for above regex

So you could try following command: $1 \U$2 \U$3 \U$4