In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Getting an ID out of text

ALLSEBS01
7 - Meteor

Hi,

 

I need to trim some text to get out an ID of the middle of it, but it doesn't seem to be working on all of them: 

 

So from this text "GBP_VEHICLES_SEPT24-120-RENAULT-T-01 - IFRS 16 Pay" I need it to return "SEPT24-120-RENAULT-T-01"

 

I have used a formula tool which is doing: TrimLeft([Text],"GBP_VEHICLES_") then I have a formula tool doing: LEFT([Batch ID],FindString([Batch ID], ' - '))

 

This didn't work on this one and returned 'T24-120-RENAULT-T-01'. 

 

However, on this one "GBP_VEHICLES_OCT24-120-DAFXB15-01 - IFRS 16 Paymen" it did return "OCT24-120-DAFXB15-01" as we wanted. 

 

So although the text will be different, the start that needs removing will always be "GBP_VEHICLES_" and the end text that needs removing will be a variant of " - IFRS 16 Payment' but some of the characters could be missing from the word Payment depending how long the ID is. 

 

Can anybody help?

1 REPLY 1
alexnajm
19 - Altair
19 - Altair

RegEx should do the trick! Something like Regex_Replace([field], "GBP_VEHICLES_(\w+-\d+-[\w-]+-\d+)\s-\sIFRS.*", "$1") worked for me

Labels
Top Solution Authors