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?
Solved! Go to Solution.
RegEx should do the trick! Something like Regex_Replace([field], "GBP_VEHICLES_(\w+-\d+-[\w-]+-\d+)\s-\sIFRS.*", "$1") worked for me