Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Removing certain words from a string

ksampson
5 - Atom

I want to remove certain words from a string based on a long list that I have.

 

So example string 

 

Record 1: The road was a long winding and grey. With an yellow wall -

Record 2: The road was a long winding and blue. With an orange wall 

 

Words to pull out 

 

Yellow 

Grey

Orange

Blue 

Purple

 

Result 

 

Record 1: Grey / Yellow

Record 2: Blue / Orange

 

I have tried the append field on the find and replace however it only appends one result from example just grey 

3 REPLIES 3
AngelosPachis
16 - Nebula

Hi @ksampson ,

 

What you can do is use a text to columns tool to split each record to each constituent words. Then maybe you can remove any punctuations (.,-) and then with a Find & Replace tool look up for the values you want to keep

 

It's important to click the Case Insensitive Find button, so yellow can be picked up although you have defined Yellow as the word you are looking for.

 

Screenshot 2021-03-17 085711.jpg

 

Appending the fields to records will then allow you to filter out the nulls and concatenate the matched words together with a summarize tool.

 

 

AngelosPachis_0-1615971412385.png

 

Hope that helps, let me know if you have any questions on the workflow.

 

Regards,

 

Angelos

ksampson
5 - Atom

 This is great is there any way to do this if there is no space

For example some sentences may look like this

 

Theroadwasalongwindingandgrey.Withanyellowwall 

pedrodrfaria
13 - Pulsar

Hi @ksampson 

 

Using a different logic, with no spaces, I think the best method would be the append fields. See attached for the WF.

pedrodrfaria_0-1615982656726.png

 

pedrodrfaria_0-1615982596404.png

 

Pedro.

Labels