title: How to handle a miss with regex / PHP / preg_match_all
body: <p>I'm using the code at the bottom to grab parameters from a wordpress shortcode.  The shortcode itself looks like this:</p>
  
  <pre><code>[FLOWPLAYER=http://www.tvovermind.com/wp-content/uploads/2013/01/pll-316-21.jpg|http://www.tvovermind.com/wp-content/uploads/2013/01/PLL316_fv2.h264HD-Clip2.flv,440,280]
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>[FLOWPLAYER=http://www.tvovermind.com/wp-content/uploads/2013/01/pll-316-21.jpg|http://www.tvovermind.com/wp-content/uploads/2013/01/PLL316_fv2.h264HD-Clip2.flv,440,280,false]
  </code></pre>
  
  <p>What I would like to have happen is that if the extra parameter (false/true) is missing then that match becomes "false",  however with the current code if the parameter is missing a match is never made.   Any ideas? </p>
  
  <pre><code>function legacy_hook($content){
      $regex = '/\[FLOWPLAYER=([a-z0-9\:\.\-\&amp;\_\/\|]+)\,([0-9]+)\,([0-9]+)\,([a-z0-9\:\.\-\&amp;\_\/\|]+)\]/i';
          $matches = array();
      preg_match_all($regex, $content, $matches);
      if($matches[0][0] != '') {
          foreach($matches[0] as $key =&gt; $data) {
              $content = str_replace($matches[0][$key], flowplayer::build_player($matches[2][$key], $matches[3][$key], $matches[1][$key],$matches[4][$key]),$content);
          }   
      }
      return $content;
  }
  </code></pre>