Alteryx designer Discussions

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

New to Regex, looking for help!

8 - Asteroid

I've done some basic regex in Alteryx in the past, but I'm struggling with getting this to work.  Below is an example string.  What I want to do is extract the four 7 digit numbers in red.  


The structure of the strings will always be the same, only the 7 digit numbers will change.


I appreciate any help I can get! Thanks!!





ACE Emeritus
ACE Emeritus

This is a pretty brittle RegEx but I think it does what you need :)


If you use the Parse method in the RegEx tool it will split into four columns.


This specifically only works for 7 digit numbers.  You could replace the \d\d\d\d\d\d\d with \d+ if you can have different length values, as long as the semicolon and comma values always exist in the correct places.

14 - Magnetar
14 - Magnetar

Hey @rhyatt!


I was able to extract the four sets of numbers with one Formula tool. I created 4 new fields, one for each of the sequences:


1st set:

REGEX_Replace([Field1], ".(\d{7}).*", "$1")

2nd set:

REGEX_Replace([Field1], ".(\d{7}).*?(\d{7}).*", "$2")

3rd set:

REGEX_Replace([Field1], ".(\d{7}).*(\d{7}).*(\d{7}).*", "$2")

4th set:

REGEX_Replace([Field1], ".(\d{7}).*(\d{7}).*", "$2")





Hope this helps!


13 - Pulsar

This will grab the first four 7-digit numbers in your string and put them in their own columns:



8 - Asteroid

Perfect!  Way more simple than I thought!!