Alteryx Designer Desktop Discussions

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

Regex parse issue

sreejithmp
8 - Asteroid

Hi Am trying to achieve the attached. Please help why alteryx reading like this city brackets missing and "\" character also adding.

Regex.JPG

3 REPLIES 3
AlteryxAlexB
Alteryx
Alteryx

Hi! 

 

I suspect your issue is around the fact that both \ and | are special characters in RegEx and need to be escaped in your formula. The below should work for your requirements:

 

REGEX_Replace([Id],'(.*\|)(.*)','$1') + [City]

 

(.*\|) - The brackets denote the first captured group, .* - zero or more of any character, up to and including |. Using the \ to escape the | special character so that Alteryx isn't recognising it as an OR function.

 

(.*) - Second caputed group, in this case everything after the |

 

Adding city in the function after the RegEx means you'll get the whole field rather as required and it wont be evaluated as part of the RegEx.

atcodedog05
22 - Nova
22 - Nova

Hi @sreejithmp 

 

Here is how you can do it.

Workflow:

atcodedog05_0-1646412117739.png

 

Hope this helps : )

 

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @sreejithmp 

Cheers and have a nice day!

Labels
Top Solution Authors