title: How to recover a string that has been split by a regular expression in Java
body: <p>We know that <code>String.split(String regex)</code> returns a <code>String[]</code>. So, how can we recover a string by using the returned <code>String[]</code> and the regex (or needs more inputs)? </p>
  
  <ol>
  <li><p>It seems like if the regex is a constant, say <code>\t</code>, we can recover the original string by appending the joint of each member of the <code>String[]</code> and the constant sequentially. However, what if the regex is sth. like <code>[AB]+</code> ? </p></li>
  <li><p>If there is a all-around way(function) that can handle the above both cases ?</p></li>
  </ol>