Upgrading Server to version 22.1? We’ve enabled the faster AMP engine by default. Read about how these system settings changes might affect you.

2022-05-24 Updates: Login: If you are facing issues with logging in, please try clearing all your cookies or trying another browser. We have a fix being deployed on the evening of 5/25. Email: If you're not seeing emails be delivered from the Community, please check your spam and mark the Community emails as not junk. Thank you for your patience.

Alteryx Designer Discussions

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

Regex query

SP3000
8 - Asteroid

Hi all,

 

I am trying to do regex in comments cells by taking out all the numbers in the different columns. I am trying to get only the 5 and 6 digits number from the comments column in separate col as attached. Please help.

 

 

7 REPLIES 7
Christina_H
11 - Bolide

Will there only ever be a single 5-digit and 6-digit number?  If so, use these in a formula tool:

5-digit: REGEX_Replace([Comment], ".*\b(\d{5})\b.*", "$1")

6-digit: REGEX_Replace([Comment], ".*\b(\d{6})\b.*", "$1")

Christina_Hurrell_0-1635868623333.png

 

SP3000
8 - Asteroid

Thank you for your quick response. Yes, there are some cases with only one 5/6 digit and some with multiple 5 and 6 digits. 

Christina_H
11 - Bolide

What do you want to do where there are multiple?  You can use a RegEx tool set to tokenize to extract all of them, but you would need two separate tools and decide how to recombine the data, see attached example.

SP3000
8 - Asteroid

Thank you so much for your kind assistance. I am able to use your approach to solve my issue.

mceleavey
17 - Castor
17 - Castor

Hi @SP3000 ,

 

in addition to @Christina_H 's approach, I've attached my approach which should be dynamic for any number of 5 or 6 digit fields and will exclude all those greater or less than that:

 

mceleavey_0-1635870821074.png

mceleavey_1-1635870894774.png

 

Hope this helps,

 

M.

 

 

 



Bulien

SP3000
8 - Asteroid

Thank you so much @mceleavey!

mceleavey
17 - Castor
17 - Castor

no problem.gif



Bulien

Labels