title: Reg Exp - insert a special character (~) between the first and the third character and only when an exact match is present
body: <p>My table has a column <code>MSG_INFO</code> with sample data:</p>
  
  <pre><code>Party is carrying gold in a car which is made of ,gold,
  Party is carrying whitegold in a car which made of gold
  </code></pre>
  
  <p>I need a SQL expression that searches for <code>gold</code> and if there is an exact match then I append <code>~</code> after the first character of the exact match <code>gold</code> and no action to be performed when there is no exact match.</p>
  
  <p><code>gold</code> can only be surrounded by space or comma on either side.</p>
  
  <p>Expected output:</p>
  
  <pre><code>Party is carrying g~old in a car which is made of ,g~old,
  Party is carrying whitegold in a car which made of g~old
  </code></pre>
  
  <p>Note - After inserting <code>~</code> space before and after gold should still be preserved.</p>
  
  <p>This is what I've started with:</p>
  
  <pre><code>SELECT REGEXP_REPLACE (msg_info, '(^|\s|\W)(gold)($|\s|\W)', '\1~\2\3', 1,0,'i')
  FROM   table;
  
  Party is carrying ~gold in a car which is made of ,~gold,
  Party is carrying whitegold in a car which made of ~gold
  </code></pre>
  
  <p>It correctly identifies the correct instances of <code>gold</code> but it puts the <code>~</code> before the word rather than after the first character.</p>