Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove the numbers at the ending of a string in 7.4 syntax?

former_member806437
Participant
0 Kudos

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!!!

3 REPLIES 3

FredericGirod
Active Contributor

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

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.

0 Kudos

I'm not a fan of Regex, I have find it on internet, better is to wait for sandra.rossi, she likes RegEx