title: Replace text using regular expressions in MS Word - C#
body: <p>I have a Word document that I want to open and replace all instances of a social security number with the word, "test".</p>
  
  <p>I already have the code to open the document. Here's the code that would do the replacement. However, I'm having trouble with using regular expressions at this point:  <b>_wordApp.Selection.Find.Text = ;</b> within my code. Is using regular expressions a good approach or is there a better approach? Bear in mind, I have to match any social security number... hence: \b[0-9]{3}-[0-9]{2}-[0-9]{4}\b OR \b[0-9]{3}[0-9]{2}[0-9]{4}\b</p>
  
  <p>Thanks in advance...</p>
  
  <pre><code>object replaceAll = Werd.WdReplace.wdReplaceAll;
  
  _wordApp.Selection.Find.ClearFormatting();
  _wordApp.Selection.Find.Text = ;
  
  _wordApp.Selection.Find.Replacement.ClearFormatting();
  _wordApp.Selection.Find.Replacement.Text = "test";
  
  _wordApp.Selection.Find.Execute(ref nullobj, ref nullobj, ref nullobj, ref nullobj,
                  ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj,
                  ref replaceAll, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
  </code></pre>