We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Help Required on Regex for parsing of the string

Bhargav
6 - Meteoroid

Hi Team,

I'm new to alteryx and was trying to parse data in a column "Task Name" using Regex but something seems to fail. This task name consists of many tasks aling with their material numbers . For Eg, In task name column which is shown below conists of tasks like "Assembly", "Approval" and material numbers like "1-1718647-1", "2314055-2" etc. 

 

I wanted to parse "1-1718647-1",  "2314055-2" material numbers out of these columns and want the output to be shown as below.

I used this regex expression "(^\d+\>\W\d+|\<\W\d\>)" to get the output but seems to fail.

Can anyone help on this?

Also, have attached excel file which has these columns for reference.

 

Task NameRegexOut
Assembly 
Approval 
1-1718647-1 Housing 2 Pos.1-1718647-1
1718654-1 Retainer 3 Pos.1718654-1
 1-1802616-1 6 Pos. MCON1-1802616-1
1802572-1 Housing1802572-1
1-1802083-11-1802083-1
0-2366427-40-2366427-4
2314055-22314055-2
53P 
13 REPLIES 13
atcodedog05
22 - Nova
22 - Nova

Hi @Bhargav 

 

You can configure regex tool like below.

atcodedog05_0-1605250704198.png

 

 

.*?\s?([\d-]*).*

 

Output:

atcodedog05_1-1605250583004.png

Hope this helps 🙂


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

 

Bhargav
6 - Meteoroid

Hi atcodedog05,

Thanks for the quick solution .

The solution provided by you is working brillantly but I have modified the table now and have a new row.

When I use your regex expression , the last row which I have inputed now also seems to be coming as an output.

Can you check the table once more and provide me the solution?

atcodedog05
22 - Nova
22 - Nova

Hi @Bhargav 

 

Here is a updated workflow

atcodedog05_0-1605252222448.png

I couldnt solve only with a regex. Please check whether it works.

 

Hope this helps 🙂


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

Bhargav
6 - Meteoroid

Hi ,

Thanks for the solution again.

Could you please take the sample file which I have attached and get me a solution because going is wrong when I apply your regex expression to the whole data.

Can you please check on the sample data I have attached?

PhilipMannering
16 - Nebula
16 - Nebula

Hey @Bhargav 

 

This seems to do the job,

 

([\d-]{5,})
atcodedog05
22 - Nova
22 - Nova

Hi @Bhargav 

 

Sorry about that. Please check the updated workflow built using the file.

atcodedog05
22 - Nova
22 - Nova

Hi @Bhargav 

 

If you want to extract number from PRJ-19-000900243 also use this workflow.

PhilipMannering
16 - Nebula
16 - Nebula

Actually... This will capture the PRJ- that sometimes appears at the start,

 

((?:PRJ-)?[\d-]{5,})
atcodedog05
22 - Nova
22 - Nova

Lot to learn from you @PhilipMannering 🙂

Labels
Top Solution Authors