title: redshift sql using regular expression to get first, second, third values from a string which is like following
body: <p>pattern: <code>d0=123;d1=134;d2=123;d3=13;d4=33;d5=44;d6=55;</code></p>
  
  <p>If want to get the first number between <code>=</code> <code>&amp;</code> <code>;</code></p>
  
  <pre><code>output: 
  123
  </code></pre>
  
  <p>If I want to get the second occurrence between <code>=</code> <code>&amp;</code> <code>;</code></p>
  
  <pre><code>output: 
  134
  </code></pre>
  
  <p>regex used:</p>
  
  <pre><code>select  
    regexp_substr(' d0=123;d1=134;d2=123;d3=13;d4=33;d5=44;d6=55;','d[0-9]+=' ,1,2) as b;
  </code></pre>
  
  <p>but output is coming like this:</p>
  
  <pre><code>d1=
  </code></pre>
  
  <p>Any pointers in this direction will be helpful.</p>