Alteryx RegEx Replace
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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!
Solved! Go to Solution.
- Labels:
- Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Amazing, thank you so much!
