Skip to content
Advertisement

To remove Unicode character from String in Java using REGEX

I am having Input String like below.

JavaScript

I want to remove Unicode characters like “u2028” , “u2019” etc if it is present in the comment section.In runtime i don’t know what are all extra characters coming. So what is the best way to handle this?

I tried like below which removes unicode characters in the given string.

JavaScript

So what is the best way to match Unicode characters are present in the comment section and if present remove those, otherwise just pass the comment to target system.

Can anyone please help me to resolve this?

Advertisement

Answer

You can do this sequentially like below:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement