community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

Regex won't parse more than 1 digit before string condition

Highlighted

Hello all,

 

I'm really new to Alteryx and Regex, and I'm having trouble parsing a pack quantity out of a description field.  Here's my current expression:

 

.*(\d+)PK.*

 

Here's the expected result:                                 But here's the output I'm getting:

Description Field       Parsed Field                      Description Field       Parsed Field    

Beer 12PK                12                                       Beer 12PK                2

Stout 4PK IPA            4                                        Stout 4PK IPA           4

 

I thought the + sign after the /d was supposed to capture one or more digits, but it looks like regex just continues once it finds at least one digit before the string, and then stops counting.  How do I get it to capture any amount of digits before the "PK" abbreviation?

 

Comet

Try setting your RegEx tool to parse and use the following expression (\d+)PK

Well that was easy, I didn't realize regex defaulted to putting wildcards around whatever your expression is.

 

Do you know why it wasn't behaving the same the way I originally had it?

 

Either way thank you so much!!

Labels