ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now
The Alteryx Community will be temporarily unavailable for a few hours due to scheduled maintenance starting on Thursday, April 22nd at 5pm MST. Please plan accordingly.

Alteryx Designer Discussions

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

Search for a word (or words) within a string and add substring before and after

jgv27
7 - Meteor

Hi everyone,

 

I need some help! I am trying to add a substring before and after certain words I'm searching for. The formatting of the original text should remain the same. It however need to identify all the different format variations of the word and add the substring to all of them.

 

Example:

String - "Thank you Alteryx for an amazing platform for Data Analysis. I am new to the data world, but am enjoying to learning experience. The problem with DATA is that it's in everything, it's dynamic, it's unstructured and difficult for an untrained process to understand. However, the better you structure the process, the better it will understand the data."

 

Search word - "data"

 

Result -  "Thank you Alteryx for an amazing platform for {_Data_} Analysis. I am new to the {_data_} world, but I am enjoying to learning experience. The problem with {_DATA_} is that it's in everything, it's dynamic, it's unstructured and difficult for an untrained process to understand. However, the better you structure the process, the better it will understand the {_data_}."

 

(Excuse the example, I had to think of something with a couple of words repeating and voilà)

 

Thanks for the help

An Alteryx Enthusiast

 

pedrodrfaria
13 - Pulsar

Hi @jgv27 

 

I believe the best way to approach this could be to use the find and replace. With the find and replace we can input a reference table with the changes to be made and make it case sensitive. There are logics you can also do with the formula tool, but i believe they would be more time consuming.

 

pedrodrfaria_0-1613047165186.png

 

Pedro.

AntDavis42
6 - Meteoroid

Hi @jgv27 ,

 

I've attached a solution using the formula and text to column tool in attempt to make it a bit more dynamic. Certainly a bit more effort than just manually entering the replace values

AntDavis42_0-1613048342353.png


Regards,

Anthony

jgv27
7 - Meteor

Thank you @pedrodrfaria and @AntDavis42 for your responses. 

 

At the end it was just as easy as using the simple find and replace tool.

Labels