title: data mismatch with spark regexp_extract
body: <p>Sample Data:</p>
  
  <pre><code>https://www.test.com/document/101?ref=stringA&amp;qid=e9f7a92b
  https://www.test.com/document/102?ref=stringB
  </code></pre>
  
  <p>Regex: <code>ref=([a-zA-Z0-9]+\.?)/?</code></p>
  
  <p>Match1 is <code>stringA</code> and <code>stringB</code></p>
  
  <p>Doing the same in pyspark </p>
  
  <pre><code>spark.sql("select regexp_extract(url, 'ref=([a-zA-Z0-9]+\.?)/?', 1) c1 from my_table").show()
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>+---------------+
  |c1             |
  +---------------+
  |stringA&amp;       |
  |stringB&amp;       |
  +---------------+
  </code></pre>