cancel
Showing results for 
Search instead for 
Did you mean: 

Alternate character is appended at the end of string using regex_replace function in SAP BODS.

0 Kudos

We have a requirement to remove all the character except (a-z, A-Z, 0-9) so we used regex_replace function.but it is working fine for some cases and in some cases some alternate character got added into end of string.

Syntax that we have used :- regex_replace(input,'\[^a-zA-Z0-9 \]','')

Anyone who faced the similar issue and how you overcome from this.

Many Thanks!

Julian_Riegel
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

could you further elaborate on this behavior and post an example of an input string and the corresponding output where you face such?

Regards,

Julian

0 Kudos

Hi Riegel,

in below example input string is 'HAMILTON' so output must be same as it's satisfying the condition of regex_replace(input,'\[^a-zA-Z0-9 \]','') but instead of this output we are getting output as 'HAMILTONRYTYNARD'. you can see some random characters got added at the end of the string. for some cases it's coming fine but for some cases this is happening.

Regards,

Bilok

Accepted Solutions (0)

Answers (1)

Answers (1)

Julian_Riegel
Product and Topic Expert
Product and Topic Expert
0 Kudos

Your regex is fine and I double checked your example on my machine - the output is as expected and remains equal.

Where does the source data come from? Can you check your data input directly on database level / system level or file level to make sure the attribute you are using your regex on actually contains only 'HAMILTON'?

To me this looks like there's some kind of last name or even an address included in the string that you just regexed.

I.e Hamilton, Rytyna RD.

Regards,

Julian

0 Kudos

Hi Riegel,

i have done some changes and added one temp table before this regex function to cross check the data and what i can see is data in that table is coming fine but once data processed through this regex function this abnormality happening. now instead of 'HAMILTON' it's coming as 'HAMILTONSQUAREIENGSN'. this is just one example and like this many other data are also affected.

Regards,

Bilok