Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Replace/Delete multiple parts of a string in formula

Alteryx Partner

Hello everyone,


I have a column of strings looking like this:


<p> This is the text. </p>


Is it possible for me to get rid of "<p>" and "</p>" using one formula? Can I use Regex?


Thank you so much for your help.


Hello wenjuanchen,


One possible way to take out <p> and </p> and keep the text in between them using formula tool is like this:



REGEX_Replace([YourField], '(\s<.*?>)|(<.*?>\s)','')



Hello Wenjuanchen,



You can use XML parse





ACE Emeritus
ACE Emeritus

You can 'nest' formula functions:


Replace(Replace([YourField],"<p> ","")," </p>","")


Alteryx Partner

Thank you @Bahouth12 @Surendar28 @tom_montpool. There are three solutions!


Hi Everyone,


I'm trying to replace multiple words in one string if the length of the string is more than for example 29. I used If and Replace formula but I can get up to 2 replace formulas under if function. Any suggestions are appreciated! 


The goal is to short address lines to the number for characters that can fit into the form line.


Thank You!


ACE Emeritus
ACE Emeritus

In this case I might be tempted to do things differently because maintaining nested ifs and nested replaces can get really confusing and tedious.


I would probably use a filter tool to split my address field into those that are longer than my maximum and those that are fine.

Then I'd create a table with the strings I want to find and what I want to replace them with. I'd then use those two streams of data to feed into the Find Replace tool.

Follow that with a Union to merge the unprocessed Filter stream with the Find Replace stream and you should be good to go.