Alteryx Designer Cloud Discussions

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

How do I replace a specific value/text, only if that value/text is at the end of the string?

Mburks32
5 - Atom
 
1 REPLY 1
Trifacta_Alumni
Alteryx Alumni (Retired)

Hi @Matthew Burks? ,

 

The easiest way to accomplish this is by using Trifacta's pattern language (you can learn more about all of the patterns in this article). 

 

To identify text that exists at the end of a string only, you can use the {end} pattern token. For example, if I want to remove the number 3 when it appears at the end of a string, but not in the middle of a string, I would type the following pattern into the "Replace text or patterns" transformation:

`3{end}`

The screenshot below shows the transformation and a preview of the results:

You can see that Trifacta will not replace the 3 in the first row, since it doesn't appear at the end of the string.

 

I hope this helps! If it does, please mark the answer as "Best" so that other users know your question has been resolved. :)