2023 May 02 6:35 AM
Hi Folks,
Could you please help me in finding the solution for below requirement.
For suppose, if a string value is 'ABC_01_BG_009', then the number after the underscore has to be removed. So the result is 'ABC_01_BG' and if it is 'ABC_01_BG_09' then the result has to be 'ABC_01_BG'
Note: The string can be of any length and the number length after underscore can be either 2 or 3.
Thanks in advance!!!
2023 May 02 11:12 AM
Search for ABAP Regex Replace
https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abenregex_replace.htm
And the Regex for you is `\d+$`
You could try using the program DEMO_REGEX_TOY
2023 May 02 11:20 AM
Loved it! But your Regex will leave the underscore, and the OP asked to remove it too (in the question text, not in the subject). I'm useless with regex, so I cannot provide additional info, just to give you my kudos.
2023 May 02 1:06 PM
I'm not a fan of Regex, I have find it on internet, better is to wait for sandra.rossi, she likes RegEx