Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
The Expert Exam is now live online! Read about the specifics and what it took to bring it to life in the blog by our very own Elizabeth Bonnell!

Regex help!

9 - Comet

Trying to replace the last part of this string after the comma(XYZZA) only in cases where it doesnt end with '_General'


FY18,Other Customer,XYZZA

FY18,Other Customer,ABC_General


Current regex is below but it doesnt work as it looks for any of the letters in general, not the entire word.



Just cant seem to figure out how to use [^] condition for an entire word.


Alteryx Certified Partner

Hi @brindhan 


Solution is attached. 





By first using a REGEX_MATCH formula, we can determine whether the string ends with '_General' and take steps from there. As per the logic, if the string ends in 'General' then we will keep as is. Otherwise, remove the last part of the string after the comma. The below formula will get this done:

if regex_match([Field1], '^.*_General$') then [Field1]
else regex_replace([Field1], '(.*,).*', '$1')


Hope this helps!

9 - Comet

This is awesome, thanks @lmorrell !