title: PHP preg_match returns only first match
body: <ol>
  <li>The first question is this:</li>
  </ol>
  
  <p>I am using <a href="http://www.phpliveregex.com/" rel="noreferrer">http://www.phpliveregex.com/</a> to check my regex is right and it finds more than one matching lines.</p>
  
  <p>I am doing this regex:</p>
  
  <pre><code>$lines = explode('\n', $text);
  foreach($lines as $line) {
      $matches = [];
      preg_match("/[0-9]+[A-Z][a-z]+ [A-Z][a-z]+S[0-9]+\-[0-9]+T[0-9]+/uim", $line, $matches);
  
      print_r($matches);
  }
  </code></pre>
  
  <p>on the <code>$text</code> which looks like this: <a href="http://pastebin.com/9UQ5wNRu" rel="noreferrer">http://pastebin.com/9UQ5wNRu</a></p>
  
  <p>The problem is that printed matches is only one match: </p>
  
  <pre><code>Array
  (
       [0] =&gt; 3Bajus StanislavS2415079249-2615T01
  )
  </code></pre>
  
  <p>Why is it doing to me? any ideas what could fix the problem?</p>
  
  <ol start="2">
  <li>The second question</li>
  </ol>
  
  <p>Maybe you've noticed not regular alphabetic characters of slovak language inside the text (from pastebin). How to match those characters and select the users which have this format:</p>
  
  <pre><code>{number}{first_name}{space}{last_name}{id_number}
  </code></pre>
  
  <p>how to do that?</p>
  
  <p>Ok first issue is fixed. Thank you @chris85 . I should have used <code>preg_match_all</code> and do it on the whole text. Now I get an array of all students which have non-slovak (english) letters in the name.</p>