Missed the Q4 Fall Release Product Update? Watch the on-demand webinar for more info on the latest in Designer 24.2, Auto Insights Magic Reports, and more!
Free Trial

Alteryx Designer Desktop Discussions

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

RegEx replace ALL CAPS words of string

Yamariot
Átomo

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 RESPOSTAS 7

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
21 - Polaris
21 - Polaris

@Yamariot 
Try with RegEx

CaptureC4B.PNG

Yamariot
Átomo

Thanks a lot! This worked perfectly.

Yamariot
Átomo

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.

@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.
Rótulos
Autores com maior número de soluções