Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Regex Help

jbh1128d1
10 - Fireball

Hello,

 

Two questions.  First, does anyone have a good online(free) regex tool to parse words out?  I have tried regexr.com and it's not user friendly to regex-rookies like myself. 

 

Second, could anyone help me parse out the bold/italic words from the below statement? 

 

I(pmax(0, rba_bucket - 3500))

 

The statement will always remain the same.  The bold/italic words will change though.  Thank you.

 

-Jordan

4 REPLIES 4
NicoleJohnson
ACE Emeritus
ACE Emeritus

This should do the trick, using the following expression and the Parse method in the RegEx tool:

 

.*\s(.*)\s-\s(.*)\){2}

 

Basically it looks for: any characters | space | (any characters) | space | dash | space | (any characters) | 2 right parentheses, and then returns whatever is inside the two bolded parentheses sections above as your two parsed columns.

 

If you're looking for a way to play around with different expressions, regex101.com is pretty good - the color coding & explanations help you see what each expression is doing/looking for. Hope that helps!

 

Cheers,

NJ

StephenR
Alteryx
Alteryx

I believe it will be   I\(pmax\(0, (.+)\)\)  with the REGEX tool set to Tokenize and Split to one column.  And, no Regex tool is friendly to regex-rookies.  The backslashes are there to escape the parentheses (make them not perform their regex function but act as characters) and the (.+) should select any number of characters that occupies that space and the Tokenize should place them in their own column.

Regards,
Stephen Ruhl
Principal Customer Support Engineer

jbh1128d1
10 - Fireball

Thank you @StephenR.  I will continue to struggle through it until it gets clear. I only use this to parse words out of r-expressions.  

MarqueeCrew
20 - Arcturus
20 - Arcturus

@jbh1128d1

 

Before using RegEx, this is how I would have handled it:

 

TrimRight(Substring([String_Field],
FindString([String_Field], ",") + 2)
,")")

FindString will return 8 as the (zero-based) location of the first comma)  

Add 2 to that and then grab characters starting in position 10 (zero-based) to the end of the field.

Now Trim away all right parens ')' and you have your data.

 

https://regex101.com/  that site works well for testing.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels