Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

RegEx replace ALL CAPS words of string

Yamariot
5 - Atom

Hi,

 

Quite new to regex and I'm having a hard time wrapping my head around something I thought to be quite straight forward.

 

I have a set of strings consisting of a mix of words. I want to remove all words that are ALL uppercase, while saving all words with first letter uppercase (Proper) as well as all lowercase words.

 

E.g.

Input

"Car BLUE FAST EXPENSIVE"

"BLUE SLOW Railroad car CHEAP"

 

Output:

"Car"

"Railroad car"

 

Would be very grateful for any help with this!

7 REPLIES 7
Maskell_Rascal
13 - Pulsar

Hi @Yamariot 

 

RegEx can get a little funny with case sensitive strings like this. My approach would be to split the data to rows, then use a Regex Match filter, and finally concatenate the results back again. 

 

Maskell_Rascal_0-1615501765062.png

 

See attached workflow.

 

If this solves your issue please mark the answer as correct, if not let me know!

 

Thanks!

Phil

 

Qiu
20 - Arcturus
20 - Arcturus

@Yamariot 
Try with RegEx

CaptureC4B.PNG

Yamariot
5 - Atom

Thanks a lot! This worked perfectly.

Yamariot
5 - Atom

Thanks a lot! This worked but went with the other suggestion as it made the flow a bit cleaner. But really appreciate your help with this!

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Yamariot ,

 

I'm sorry that I'm late to the party.

 

 

REGEX_Replace([Field1], "\b\u+\b", '',0)

 

 

It looks for only letters that are continuous within a word boundary.  It doesn't convert data to rows or require additional data cleanup to remove spaces.  I like it.

 

 

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Maskell_Rascal
13 - Pulsar

@MarqueeCrew This is the cleanest answer! I was trying to figure out something similar, but didn't think about using a word boundary. 👍

MarqueeCrew
20 - Arcturus
20 - Arcturus

Thanks Phil!

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels