using System.Text.RegularExpressions;
public static void Main()
string plainTextValue = string.Empty;
plainTextValue = "Pricing Obfuscation Test:\r\n $100, $ 100, $100.00, $ 100.00, $.10, $ .10, ($100), ($ 100), ( $100), (100), (100.00)";
string output = Test(plainTextValue);
Console.WriteLine(output);
private static readonly Regex Pattern = new Regex( @"[^\(\p{Sc}.*\)](\p{Sc}\s?[+-]?[0-9]{1,3}(?:,?[0-9])*(?:\.[0-9]{1,2})?|((\p{Sc}\s?)+\.[0-9]{2}))|\((\p{Sc}[^)]*)\)", RegexOptions.Compiled);
private const string replaceValue = @"$___";
private static string Test(string input)
return Pattern.Replace(input, match => { string newMatch = match.Groups[1].Value; return replaceValue; });