title: Spark Regexp: Split column based on date
body: <p>I have a column, called "data", in my dataframe that looks like this:</p>
  
  <p><code>{"blah:"blah","blah":"blah"""10/7/17service</code></p>
  
  <p>I would like to separate this into three different columns that look like:</p>
  
  <p><code>col1: {"blah:"blah","blah":"blah"""
  col2: 10/7/17
  col3: service
  </code></p>
  
  <p>I have tried this approach:</p>
  
  <p><code>val separate = df.withColumn("col1", regexp_extract($"data", "(/(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d/)", 1)
  .withColumn("col2",regexp_extract($"data", "(/(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d/)", 2))
  </code></p>
  
  <p>But this regex doesn't really get me through the door. I feel like I'm missing something about how the regex operator works in Spark. Any ideas?</p>
  
  <p>Thanks so much!! :)</p>
  
  <p>edit-rules for columns:</p>
  
  <ul>
  <li>col1: before the date value </li>
  <li>col2: date value </li>
  <li>col3: after the datevalue</li>
  </ul>