title: multiple patterns with preg_match
body: <p>My situation is: I'm processing an array word by word. What I'm hoping to do and
  working on, is to capture a certain word. But for that I need to test two patterns or more with preg-match.</p>
  
  <p>This is my code : </p>
  
  <pre><code>function search_array($array)
  {
  $pattern  = '[A-Z]{1,3}[0-9]{1,3}[A-Z]{1,2}[0-9]{1,2}[A-Z]?';
  $pattern2 = '[A-Z]{1,7}[0-9]{1,2}';
  $patterns = array($pattern, $pattern2); 
  $regex = '/(' .implode('|', $patterns) .')/i'; 
  foreach ($array as $str) {
    if (preg_match ($regex, $str, $m)){
      $matches[] = $m[1];
      return $matches[0]; 
    }
   }
  }
  </code></pre>
  
  <p>Example of array I could have  :</p>
  
  <pre><code>Array ( [0] =&gt; X [1] =&gt; XXXXXXX [2] =&gt; XXX [3] =&gt; XXXX [4] =&gt; ABC01DC4 )
  
  Array ( [0] =&gt; X [1] =&gt; XXXXXXX [2] =&gt; XXX [3] =&gt; ABCDEF4 [4] =&gt; XXXX [5] =&gt; XX )
  </code></pre>
  
  <p>Words I would like to catch :</p>
  
  <pre><code>-In the first array  : ABC01DC4
  
  -In the second array : ABCDEF4
  </code></pre>
  
  <p>The problem is not the pattern itself, it's the syntax to use multiple pattern in the same pregmatch</p>