How to Replace [Word] with Word using Regex.Replace and should replace whole word only
<p>I'm working on a translation project right now.
One of the issues that I encountered is when I'm trying to replace words special characters.</p>

<p>For example:</p>

<pre><code>[Animal] can be furry.
Dog is an [Animal].
</code></pre>

<p>I need to replace <code>[Animal]</code> with <code>Animal</code>. Please take note that I need to replace the whole word only. So the result should be as followed:</p>

<pre><code>Animal can be furry.
Dog is an Animal.
</code></pre>

<p>Also, as I've said, it should be the whole word. So if i have:</p>

<p><code>[Animal][Animal][Animal] can be furry.</code> - the result should still be</p>

<p><code>[Animal][Animal][Animal] can be furry.</code> - nothing happened as <code>[Animal]</code> is not the same as <code>[Animal][Animal][Animal]</code></p>

<p>Sample:</p>

<pre><code>string originalText1 = "[Animal] can be furry";
string badText ="[Animal]";
string goodText = "Animal";

Regex.Replace(originalText1,  Regex.Escape(badText), Regex.Escape(goodText));
</code></pre>

<p>Everything is ok. But as I've said, I need the whole word to be replaced. And with the above code, "<code>[Animal]can be furry</code>" will be replaced by "<code>Animalcan be furry</code>" which is a no no.</p>

<p>so I also tried:</p>

<pre><code>Regex.Unescape(
 Regex.Replace(
  Regex.Escape(originalText1), 
  String.Format(@"\b{0}\b", Regex.Escape(badText)), 
  Regex.Escape(goodText)))
</code></pre>

<p>Still won't work though. And now I'm lost. Please help.</p>

<p>I'd also like to mention that there's an ALMOST similar post, but that question didn't require the replacement of  whole word only. I've looked over the net for almost 3 hours to no avail. Your help will be greatly appreciated. Thanks!</p>
