Alteryx Designer Desktop Discussions

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

Regex tool

Hi2023
8 - Asteroid

I have ID CODES that I need to pull out all ING and MUER codes but these have ING A, ING B, ING C, etc and same for MUER A, MUER B, MUER C, I need to pull out of ID codes column all the ones that have a ING and MUER even the ones with the A, B, C added after.

 

I used REGEX match with beginning of word but its not working

 

nay help thanks@!

8 REPLIES 8
binuacs
21 - Polaris

@Hi2023 use the StartsWith Formula

 

StartsWith([Field],"ING") OR StartsWith([Field],"MUER") 

alexnajm
18 - Pollux
18 - Pollux

Match will tell you if it matches the pattern or not. Try REGEX_Match([ID Codes],"(\w+)\s.+") 

 

If you want to pull out the ING and MUER into its own column, I would do:

 

REGEX_Replace([ID Codes],"(\w+)\s.+","$1")

Hi2023
8 - Asteroid

Can you explain what [ID Codes],"(\w+)\s.+","$1") means? plz

Hi2023
8 - Asteroid

I used the formula for this and didnt work? 

binuacs
21 - Polaris

@Hi2023 attaching a sample workflow

image.png

alexnajm
18 - Pollux
18 - Pollux

The REGEX_Replace is only helpful if you want to parse out the ING and MUER into it's own column - the formula is identifying the pattern as one or more word characters (\w+) followed by a single space (\s) followed by one or more of any other characters (.+). The $1 corresponds to the marked group (aka parentheses) around the only part we want to keep.

 

Based on the use case description, you want to Filter, not use a Formula.

Hi2023
8 - Asteroid

Thank you. Where is the best place to get this info on the character meanings?

alexnajm
18 - Pollux
18 - Pollux

regex101: build, test, and debug regex

 

If you could accept this as a solution as well, that would be great!

Labels
Top Solution Authors