title: How to use regex with pandas.Series.str.replace()
body: <p>I'm trying to replace specific parts of a string with the pandas.Series.str.replace() method using regex to define the parts I want to change, according to the docs you can use regular expressions and even re.compile objects. I just can't work out what I'm doing wrong but I just seem to erasing completely, instead of replacing parts of the string. </p>
  
  <p>So in my DataFrame let's say I have a column called ['dates'], which is formatted like this:</p>
  
  <pre><code>'2016-03-26 17:47:46'
  </code></pre>
  
  <p>I just want to grab the dashes, space and the time (leaving the 8 digits as a date) - then replace them with '' hopefully leaving 20160326, so I make an re.compile object which grabs those:</p>
  
  <pre><code>re_express = re.compile('[\d]{4}(.)[\d]{2}(.)[\d]{2}(.*)')
  </code></pre>
  
  <p>Then I attempt replacing them with this line:</p>
  
  <pre><code>df['date'] = df['date'].str.replace(re_express,'')
  </code></pre>
  
  <p>Unfortunately this just erases the date completely, leaving '' in my ['dates'] column. These re.compile objects are accepted according to the docs, if I used re.findall() then that regex string would grab the parts I want from that date, so I can only assume I cannot use them the same way in this method. It there an adjustment I can make to make this work?</p>