Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Extract a Single Characted from a String

Tommy_Alterax
8 - Asteroid

Hi Guys,

 

I'm wondering can Reg Ex tool be used (Without Text to columns) in order to extract the first alphabetical charater in a string when reading from left to right

 

12874-0001BDUSDXXXXXXXXX

 

For example above it would be "D" - Going from left to right

 

Thanks 🙂

18 REPLIES 18
Tommy_Alterax
8 - Asteroid

Okay so sample data here 

 

Only where data is "Type 1" do I want the the first alpha character reading left to right extracted (your regex solution above) - For type 2 and 3 this is not relevant - Im looking to avoid filtering out data types and then rejoining data sets

 

 

Data SubSourceInvoice Code
Type 112874-0014TDUSDXXXXXXXXX
Type 112874-0001BDUSDXXXXXXXXX
Type 112874-0001BDUSDXXXXXXXXX
Type 113170-0001BDUSDXXXXXXXXX
Type 113182-0001BDUSDXXXXXXXXX
Type 113182-0002TDUSDXXXXXXXXX
Type 112874-0001MDUSDXXXXXXXXX
Type 112874-0002TDUSDXXXXXXXXX
Type 113170-0002TDUSDXXXXXXXXX
Type 25900156017
Type 2590015999
Type 2590015999
Type 3590015999
Type 3590015999
Tommy_Alterax
8 - Asteroid

Hi,

 

Here is a sample of my data (excel file attached) -

 

I am only concerned with executing the regex solution you posted for Type 1 'Data Types' - Ideally I would like to do this outisde of a filter and join

 

Thks,

 

Tommy

 

 
 

 

 

 

 

atcodedog05
22 - Nova
22 - Nova

Hi @Tommy_Alterax 

 

Here is a workflow for the task.

Output:

atcodedog05_0-1605786583443.png

Workflow:

atcodedog05_1-1605786603798.png

 

Hope this helps 🙂


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

atcodedog05
22 - Nova
22 - Nova

Hi @Tommy_Alterax 

 

The same can be used for excel too.

Output

atcodedog05_0-1605786864243.png

 

Tommy_Alterax
8 - Asteroid

Thanks for your time here 

 

In your solution below it returns a value for Type 2 when there is an alpha character (Row 10) - I Want to return 'Null' for Type 1 and Type 2 and thne return a value for Type 3 only

 

Basically my Type 1 & Type 2 will be a mixture of numbers and alpha characters - 

atcodedog05
22 - Nova
22 - Nova

Hi @Tommy_Alterax 

 

Here is a workflow for the task.

Output:

atcodedog05_0-1605791066631.png

 

Hope this helps 🙂


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

Tommy_Alterax
8 - Asteroid

Thanks for this - Its like reading spanish to me but it works - I cannot wait for the day I understand this regex tool - Thank you !!

MarqueeCrew
20 - Arcturus
20 - Arcturus

Hi @Tommy_Alterax ,

 

A non-regex approach:

 

IF [data subsource] = "Type 1" THEN

     Left(replacechar([invoice code],"0123456789-",""),1)

ELSE Null()

ENDIF

 

 cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
atcodedog05
22 - Nova
22 - Nova

Happy to help 🙂 @Tommy_Alterax 

 

Cheers and Happy Analyzing 😀

 

All the best with your learning 🙂

 

Feel free to reach out if you face any other issues 🙂

Labels