title: string.IndexOf search for whole word match
body: <p>I am seeking a way to search a string for an exact match or whole word match.  <code>RegEx.Match</code> and <code>RegEx.IsMatch</code> don't seem to get me where I want to be.  <br>Consider the following scenario:</p>
  
  <pre><code>namespace test
  {
      class Program
      {
          static void Main(string[] args)
          {
              string str = "SUBTOTAL 34.37 TAX TOTAL 37.43";
              int indx = str.IndexOf("TOTAL");
              string amount = str.Substring(indx + "TOTAL".Length, 10);
              string strAmount = Regex.Replace(amount, "[^.0-9]", "");
  
              Console.WriteLine(strAmount);
              Console.WriteLine("Press any key to continue...");
              Console.ReadKey();
          }
      }
  }
  </code></pre>
  
  <p>The output of the above code is:</p>
  
  <pre><code>// 34.37
  // Press any key to continue...
  </code></pre>
  
  <p>The problem is, I don't want <strong><code>SUBTOTAL</code></strong>, but <code>IndexOf</code> finds the first occurrence of the word <strong><code>TOTAL</code></strong> which is in <strong><code>SUBTOTAL</code></strong> which then yields the incorrect value of 34.37.  </p>
  
  <p>So the question is, is there a way to force <code>IndexOf</code> to find only an exact match or is there another way to force that exact whole word match so that I can find the index of that exact match and then perform some useful function with it. <code>RegEx.IsMatch</code> and <code>RegEx.Match</code> are, as far as I can tell, simply <code>boolean</code> searches.  In this case, it isn't enough to just know the exact match exists.  I need to know where it exists in the string.</p>
  
  <p>Any advice would be appreciated.</p>