Alteryx Designer Desktop Discussions

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

Please help on Alteryx - how to extract part of the string with given conditions

JT0168
7 - Meteor

Given strings "INV # 34571, P.O. # 0002015101" or sometimes "2024597-1" and wanted to get those character starting from either one of the following 201, 202, 203, 204, 205 including the next 4 characters after 201, 202, 203, 204, 205 thereby having in my new field the following strings 2045101 and 2024597.  Thanks!    

8 REPLIES 8
IraWatt
17 - Castor
17 - Castor

Hey @JT0168,

I would use the Regex Parse tool for this:

IraWatt_0-1657143269692.png

(20[12345].{4})

This regex gets 201, 202, 203, 204, 205 then 4 characters after it.

Any questions or issues please ask :)
HTH!
Ira

PhilipMannering
16 - Nebula
16 - Nebula

You can use the Regex Tool set to Parse and use the expression,

(20[1-5].{4})
binuacs
20 - Arcturus

@JT0168 one way of doing this with the Regex Tokenize

binuacs_0-1657143591236.png

 

JT0168
7 - Meteor

Thanks for the solution but I also need to include this.....

 

How about if there is another part in that same column that I need to extract those with "R0000" followed by 5 characters how to include that in the same expression? the actual string in the column would look the same 

 

 "INV # 34571, P.O. # R000031361" or sometimes "R000045241-1"

 

the output must be

 

R000031361

R000045241 

PhilipMannering
16 - Nebula
16 - Nebula

To prevent too much back and forth, can you supply the input with a decent sample and expected output? I'm sure between us we can solve this 

IraWatt
17 - Castor
17 - Castor

Hey @JT0168 

For your R0000 I added a | which means OR in Regex, I then added R0000 so it looks for that pattern then .{5} means 5 of any character. 

(20[12345].{4}|R0000.{5})

 Hopefully this will help with other patterns you want to match with. I would check out Interactive Lessons - Alteryx Community Regex the community has some great videos on how to use Regex.

JT0168
7 - Meteor

 

would like to seek your help on this......as this was not captured in the previous workflow subject those with comma.. thank you!

 

This is the excel file that I have (please see below)

 

SKURef Number 1Ref Number 2
531720,420,270,002,041,50020,420,270,002,041,500
207320,420,270,002,041,50020,496,060,002,051,600
726420,420,270,002,041,50020,471,610,002,048,700
923820,420,270,002,041,50020,447,220,002,043,900
89320,420,270,002,041,50020,575,240,002,062,500
90720,420,270,002,041,50020,618,820,002,064,600
202520,420,270,002,041,5002040097
3085620,420,270,002,041,50020,458,330,002,046,800
8128420,420,270,002,041,50020,531,130,002,055,200
684020,420,270,002,041,50020,447,340,002,044,700

 

 

and this should be the output....

 

Ref 1 becomes ref 1A and 1B, I need those 7 digit that starts with 201 up to 210

Ref 2 becomes ref 2A and 2B, I need those 7 digit that starts with 201 up to 210

 

 

SKURef Number 1_ARef Number 1_BRef Number 2Ref Number 2_B
53172042027204150020420272041500
20732042027204150020496062051600
72642042027204150020471612048700
92382042027204150020447222043900
8932042027204150020575242062500
9072042027204150020618822064600
2025204202720415002040097 
308562042027204150020458332046800
812842042027204150020531132055200
68402042027204150020447342044700

 

 

IraWatt
17 - Castor
17 - Castor

Hey @JT0168,

Very similar to the pervious solution you can do it like this:

IraWatt_0-1662567107847.png

This solution uses the transpose and cross tab tools which can be hard to understand to new users. I would recommend checking out the community Getting-Started-Learning-Path for some context on how they work: https://community.alteryx.com/t5/Learning-Paths/Getting-Started-Learning-Path/ta-p/475117#done

 

Any questions or issues please ask

Ira Watt
Technical Consultant
Watt@Bulien.com 

 

Labels