title: Sparklyr/Hive: how to use regex (regexp_replace) correctly?
body: <p>Consider the following example</p>
  
  <pre><code>dataframe_test&lt;- data_frame(mydate = c('2011-03-01T00:00:04.226Z', '2011-03-01T00:00:04.226Z'))
  
  # A tibble: 2 x 1
                      mydate
                       &lt;chr&gt;
  1 2011-03-01T00:00:04.226Z
  2 2011-03-01T00:00:04.226Z
  
  sdf &lt;- copy_to(sc, dataframe_test, overwrite = TRUE)
  
  &gt; sdf
  # Source:   table&lt;dataframe_test&gt; [?? x 1]
  # Database: spark_connection
                      mydate
                       &lt;chr&gt;
  1 2011-03-01T00:00:04.226Z
  2 2011-03-01T00:00:04.226Z
  </code></pre>
  
  <p>I would like to modify the character <code>timestamp</code> so that it has a more conventional format. I tried to do so using <code>regexp_replace</code> but it fails.</p>
  
  <pre><code>&gt; sdf &lt;- sdf %&gt;% mutate(regex = regexp_replace(mydate, '(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2}).(\\d{3})Z', '$1-$2-$3 $4:$5:$6.$7'))
  &gt; sdf
  # Source:   lazy query [?? x 2]
  # Database: spark_connection
                      mydate                    regex
                       &lt;chr&gt;                    &lt;chr&gt;
  1 2011-03-01T00:00:04.226Z 2011-03-01T00:00:04.226Z
  2 2011-03-01T00:00:04.226Z 2011-03-01T00:00:04.226Z
  </code></pre>
  
  <p>Any ideas? What is the correct syntax?</p>