Alteryx Designer Desktop Discussions

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

regex help parsing

hudg16
7 - Meteor

I use the following to parse name space name and it works great with the following exception: 
(^.*?\s.*?[+]|^.*?\s.*?\s)

 

hudg16_0-1632763647861.png

 

 

This regex works for me on literally everything, except this one instance of Otterbox. Does anyone have any idea why it works on the one, but not the others? To be clear, the goal is the first one. I have also tried renaming the description in various ways to no avail (and would rather rename the description than change the regex probably). Thanks

6 REPLIES 6
atcodedog05
22 - Nova
22 - Nova

Hi @hudg16 

 

Can you provide some expected output it will help us get a better understanding of the usecase.

hudg16
7 - Meteor

The expected output is the first row of that table, and Alteryx does that "iPhone 13PRMX", but also proceeds to add Otterbox into some of them for some unknown reason. 

atcodedog05
22 - Nova
22 - Nova

Hi @hudg16 

 

You can regex like below. 


Workflow:

atcodedog05_0-1632767401851.png

 

Hope this helps : )

mst3k
11 - Bolide

your formula

 

^.*?\s.*?[+]

 

i believe this says start with anything until a space, then anything up until a +, which grabs that "OTTERBOX" word in between.

the first row is working correctly only because it's using the 2nd half of your regex after the OR | since there is not a + in the first value. it satisfies the rule

^.*?\s.*?\s

start with anything up until a space, then anything up until a space again

 

if the goal is just the value from the first line, what's wrong with what you've already got in the 2nd part of your formula, just using that? i would move the last \s out of your marked group though, or else you'll have to strip the trailing whitespace later

in parse mode: (^.*?\s.*?)\s

 

mst3k_1-1632768162023.png

 

 

hudg16
7 - Meteor

The weird thing is that it works for items like 
IPHONE 11 CASECO FREMONT GLITTER BLACK >>>>> IPHONE 11

But on my first run here, this new expression works good. Thanks. 

mst3k
11 - Bolide

that's because your original formula

 

(^.*?\s.*?[+]|^.*?\s.*?\s)

 

is basically 2 formulas in 1,

^.*?\s.*?[+]    OR    ^.*?\s.*?\s

 

There's no "+" in the value "IPHONE 11 CASECO FREMONT GLITTER BLACK >>>>> IPHONE 11" so it doesn't use this formula, and uses the second one instead, which works on its own for all your values

 

I'm not 100% sure it's actually looking for the value "+" either, since + is one of the codes for regex, it may be interpreting it slightly differently (a strict + would have needed an escape like \+ I think? but I'm not totally sure), but for all intents and purposes it's that first formula that's triggering the rows you don't want as far as I can tell. So it only messes up for your values that have that + in it

Labels