title: Regex to replace cash values in a string
body: <p>I am trying to make a regex to replace cash values in a sentence, and so far I am using this regex <code>[+-]?\$\s?((\d{1,3},?)+.?\d{2}?)\b</code>.</p>
  
  <p>Here are the test cases I came up with where <code>test</code> are cases that should be captured and replaced and <code>ntest</code> are fals positives.</p>
  
  <pre><code>public static void Main(string[] args)
  {
      string test = "$500, $5,000.00  $50.00   $.99  $80 -$500 $90!";
      string output = Regex.Replace(test, @"[+-]?\$\s?((\d{1,3},?)+.?\d{2}?)\b", "money");
      Console.WriteLine(output);
  
      string ntest = "a$500, 00$5,000.00  $50.$00   $.99.00.00  $80.0000 --$90.00  !$90 ";
      string output2 = Regex.Replace(ntest, @"[+-]?\$\s?((\d{1,3},?)+.?\d{2}?)\b", "money");
      Console.WriteLine(output2);
  
  }
  </code></pre>
  
  <p>So far it captures most of the test cases, but I am having trouble defining the boundaries. Results:</p>
  
  <pre><code>money, money  money   $.99  $80 money $90!
  amoneymoney  $50.$00   $.99.00.00  $80.0000 -money  !$90 
  </code></pre>
  
  <p>The results should actually look like:</p>
  
  <pre><code>money, money  money   money  money money money!
  a$500, 00$5,000.00  $50.$00   $.99.00.00  $80.0000 --$90.00  !$90  
  </code></pre>