title: What is the most efficient way to remove every other character from a string?
body: <p><a href="https://stackoverflow.com/questions/3166407/removing-every-other-character-in-a-string-using-java-regex">Removing every other character in a string using Java regex</a></p>
  
  <p>The code at the above link clearly details how to remove every other character from a string, however, I do not understand how it works and would like to so I can use it in the future. The Oracle page for replaceAll does not mention this type of use.  What is the function of the $1 and the periods and the parentheses (I get that the one in parentheses is the one that is kept, but why, etc.?  Thanks! :)</p>