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 🙂
Solved! Go to Solution.
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 SubSource | Invoice Code |
Type 1 | 12874-0014TDUSDXXXXXXXXX |
Type 1 | 12874-0001BDUSDXXXXXXXXX |
Type 1 | 12874-0001BDUSDXXXXXXXXX |
Type 1 | 13170-0001BDUSDXXXXXXXXX |
Type 1 | 13182-0001BDUSDXXXXXXXXX |
Type 1 | 13182-0002TDUSDXXXXXXXXX |
Type 1 | 12874-0001MDUSDXXXXXXXXX |
Type 1 | 12874-0002TDUSDXXXXXXXXX |
Type 1 | 13170-0002TDUSDXXXXXXXXX |
Type 2 | 5900156017 |
Type 2 | 590015999 |
Type 2 | 590015999 |
Type 3 | 590015999 |
Type 3 | 590015999 |
Here is a workflow for the task.
Output:
Workflow:
Hope this helps 🙂
If this post helps you please mark it as solution. And give a like if you dont mind 😀👍
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 -
Here is a workflow for the task.
Output:
Hope this helps 🙂
If this post helps you please mark it as solution. And give a like if you dont mind 😀👍
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 !!
Hi @Tommy_Alterax ,
A non-regex approach:
IF [data subsource] = "Type 1" THEN
Left(replacechar([invoice code],"0123456789-",""),1)
ELSE Null()
ENDIF
cheers,
mark
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 🙂