I have a requirement to trim all the aphabets and special characters except one from a user entered input. So I request you to let me know any existing function like this or help me with the java code, please.
Sample input:
123.899INR
123INR
123%
123.00%
Sample output:
123.899
123
123
123.00
So, I am a expecting a function like, it should accept the property and excluding char as inputs
We have the @pxReplaceAllViaRegex(String input, String regularexpression, String stringtoinsert) function available in Pega, Where it will replace all matches of a regular expression with the string to insert.
For example @pxReplaceAllViaRegex(“123.456%”,“[%]”,“”) will return 123.456 and @pxReplaceAllViaRegex(“123.456INR”,“[a-zA-Z]”,“”) will return 123.456
You can include all the special characters in the regular expression which you need to replace in the inputstring.