Preserve minus

In the following regular expression I like to preserve the minus sign that appears sometimes at the beginning of the amount (if negative amount) before the optional dollar sign, while replacing all dashes in the amount. How to modify?
Thank you,

System.Text.RegularExpressions.Regex.Replace(Amount, “[^0-9,.]+”,“”)

You can try ([^0-9,.-]+”,“”)

Hi @A_Learner ,

Could you provide us with Sample data, this way we will be able to help faster by providing the appropriate suggestions directed towards your case and then generalise it.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.