title: PHP regex to parse wordpress shortcode attribute
body: <p>I am trying to regex all lightbox wordpress shortcodes and receive their 'link' attribute.</p>
  
  <p>Example:</p>
  
  <pre><code>[lightbox link="http://www.test.com/photo1.jpg" width="150" align="none" title="photo 1" frame="true" icon="image"]
  [lightbox link="http://www.test.com/photo2.jpg" width="150" align="none" title="photo 2" frame="true" icon="image"]
  ...
  [lightbox link="http://www.test.com/photo5.jpg" width="150" align="none" title="photo 5" frame="true" icon="image"]
  </code></pre>
  
  <p>There can be any number of these shortcodes but I need to get all their link attributes:</p>
  
  <pre><code>http://www.test.com/photo1.jpg
  </code></pre>
  
  <p>My pattern I am working with:</p>
  
  <pre><code>$pattern = '/\[(\[?)(lightbox)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)/';
  </code></pre>