title: How to extract regex group through Redshift psql
body: <p>The same regex pattern I tried on python and Redshift psql, works on python but not on Redshift psql.</p>
  
  <p>I have the strings look like this:
  <code>s = 'AB.w127 xyz (9f6h, 89) amf, like mr .345x980 abcd'</code>
  <strong>I want to extract everything between "AB" and ".345x980"</strong> ("w127 xyz (9f6h, 89) amf, like mr " in this case), the multiplied numbers here will vary, and the content in between is totally unpredictable.
  So in my Redshift psql query, I used <code>regexp_substr(s, 'AB\.(.*?)\.\d+x\d+.*?')</code>. I was hoping to at least get something so that later I can use <code>group(1)</code> as python logic.</p>
  
  <p>But Redshift kept showing me this error:</p>
  
  <blockquote>
    <p>Invalid preceding regular expression prior to repetition operator.  The error occured while parsing the regular expression: 'AB.(.<em>?>>>HERE>>>).d+xd+.</em>?'.</p>
  </blockquote>
  
  <p>I also tried the pattern <code>AB\\.(.*?)\\.\\d+x\\d+.*?')</code>, but still got the same error.</p>
  
  <p>Is there anyway to extract the string with Redshift psql?</p>