Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Alteryx RegEx Replace

RichW123
6 - Meteoroid

Hi,

 

I currently have a list of organisations that I wish to replace the text of, depending on the beginning of the organisation string.

 

For example, "Consulting National BXT..." I want to become "Advisory - Consulting".

 

Initially, I though RegEx would be handy by using the regular expression: (^Consulting), set it to replace and have the replacement text as "Advisory - $1". However, this keeps all the text after the word "Consulting" which I don't want.

 

I could untick "Copy unmatched text to output" but I don't want to make all the other organisations that don't match the expression blank.

 

Is there a way to do this?

 

Thanks!

2 REPLIES 2
danilang
19 - Altair
19 - Altair

Hi @RichW123 

 

Your intiial expression (^Consulting) matches any string that starts with "Consulting", but doesn't take into account any characters that follow it.  Change it to (^Consulting).* so any following chars will be matched but not captured by $1

 

danilang_0-1684758468144.png

 

Dan

   

RichW123
6 - Meteoroid

Amazing, thank you so much!

Labels
Top Solution Authors