title: Teradata regular expressions, look behind
body: <p>I have a field, Simplified_Description and I'm looking for patterns in it.  Specifically, I'm looking for a pattern like 6 X 8 or 6X8 or 600X800.  I want to pull out the first and second numbers into new fields.  I've been able to get the first number (with much help) using a look-ahead.</p>
  
  <pre><code>REGEXP_substr(Simplified_Description, '[0-9]+(?= {0,1}[X] {0,1}[0-9]+)') AS FirstNum,
  </code></pre>
  
  <p>When I try to get the second number by changing the look-ahead to a look-behind (by simply adding in a "&lt;"),</p>
  
  <pre><code>REGEXP_substr(Simplified_Description, '[0-9]+(?&lt;= {0,1}[X] {0,1}[0-9]+)') AS SecondNum
  </code></pre>
  
  <p>I now get an error</p>
  
  <pre><code>SELECT Failed.   [9134] The pattern specified is not a valid pattern.
  </code></pre>
  
  <p>I am a complete newb on regular expressions, especially on look-ahead and look-behind, so it's possible I have some extremely simple error, but I can't figure it out as what I'm doing appears to be the correct syntax.</p>