Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
RÉSOLU

Regex query

SP3000
Astéroïde

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 RÉPONSES 7
Christina_H
Magnétar

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
Astéroïde

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
Magnétar

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
Astéroïde

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
Astéroïde

Thank you so much @mceleavey!

mceleavey
17 - Castor
17 - Castor

no problem.gif



Bulien

Étiquettes