Regex Expression to remove special characters before the numeric

Hello UiPath Family,

Please help with a Regex function that removes special characters before the numeric. I am working on a bot where it extract payment of customers. The figures are supposed to like 170.00, 200.09, 1000.00, but instead the bot logs it as 17000, 20009, 100000, eliminating the dot(.) sign. Please assist with the regex expression to eliminate all special characters before the numbers and maintains the dot(.) sign.

Thank you.

Hi @Baba_Karim_Abdulai

Could you try the following Regex:

\d+\.\d+

Output on RegEx 101:

If this solves your query, Do mark it as a solution.
Happy Automation :star_struck:

Hi @Baba_Karim_Abdulai

Use Assign activity:
CleanAmount = System.Text.RegularExpressions.Regex.Replace(rawText,“[^0-9.]”, “”)

This keeps only digits and dot, removing all other special characters.

If you found helpful please mark as a solution. Thanks
Happy Automation with UiPath

Hi @Baba_Karim_Abdulai

What data type are you storing the values in?

Doubles are for decimals making them a good choise for your requirement.
For example Integers cannot contain divider characters.

Regards
Soren

@Baba_Karim_Abdulai ,
Try following logic

1. Create variable named 'CleanedAmount'
2. use assign activity
3. CleanedAmount = System.Text.RegularExpressions.Regex.Replace(rawText, "[^\d.]", "")

Try replacing the “.” with an “" before you apply the regex. Once the regex removes all other special characters, replace the "” with “.”.