title: add character to a string at specific place based on Regular expression
body: <p>Is there a way to add a character, say <code>'\t'</code>, at specific position of the string?</p>
  
  <p>For example:</p>
  
  <pre><code>String str = "key1=123 key2=text with spaces key3=foo";
  </code></pre>
  
  <p>I need to replace all spaces before keys with tabs in the key value pair string.</p>
  
  <p>Note that some values may contain spaces.</p>