Alteryx Designer Desktop Discussions

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

How to get rid of multiple and different characters in a column

acaryasin01
8 - Asteroid

 

Hi guys,

 

I have date colum include companys' name + "_raw_data" +  Q1 or Q2 or H1.

 

How can I get rid of the  "_raw_data" +  Q1 or Q2 or H1.

 

Here is colummn and desired column example.

 

ColumnDesired column
ABC_raw_dataABC
XYZ 1Q_raw_dataXYZ
XYZ_raw_dataXYZ
DEF INTERNATIONAL Q1_raw_dataDEF INTERNATIONAL
DEF INTERNATIONAL Q2_raw_dataDEF INTERNATIONAL
KLS HOLDING H1_raw_dataKLS HOLDING
KGS H1_raw_dataKGS
7 REPLIES 7
Christina_H
14 - Magnetar

Here's my quick take on this - using find/replace to replace the strings you don't want with spaces, then data cleansing to remove trailing spaces.

atcodedog05
22 - Nova
22 - Nova

Hi @acaryasin01 

 

Here is how you can do it.

 

Formula:

REGEX_Replace(Replace([Column], "_raw", " "), "([\u\s]+)\s(.*)", "$1")


Workflow:

atcodedog05_0-1631180667036.png

 

Hope this helps : )

 

acaryasin01
8 - Asteroid

Hi @Christina_H 

 

This solution also works, but my workflow is more complex, buecause of that regex is more usefull for my workflow

 

Thank you for your time and respond, appriciated 😊

acaryasin01
8 - Asteroid

Hi @atcodedog05 

 

Thank you for detailed answer, excellent 👍👌

 

I think, Regex is an another world, how can translate regex expression to daily talk, 

 

have you any sources to understand insight of regex?

atcodedog05
22 - Nova
22 - Nova

Hi @acaryasin01 

 

I personally learnt some from the resources but a lot from other people's approaches. I am still a continuous learner when it comes to Regex. Here are some resources which might help you. 

 

https://regexr.com/

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Tool-Mastery-RegEx/ta-p/37689 

 

Happy to help : )

Cheers and have a nice day!

acaryasin01
8 - Asteroid

Thank you @atcodedog05  for sharing useful and important info

 

Congratulations for your being humbe 👏👏👏

Agaton
5 - Atom

Hello,

 

Could I ask if using the Regex_Replace help in removing three different text like "Primary Owner", "Primary Owner - Auto" and "Second Owner" or should I use if function? I would be grateful for any idea. Thank you. :)

Labels