title: php - word between space and tab (or: sort attendance report alphabetically)
body: <p>I am trying to extract the last name of a attendance report for sorting it alphabetically by last name.
  The attendance report (should be an .cvs) looks like this:</p>
  <pre><code>Artur Testme    Left    27.1.2021, 10:34:15
  </code></pre>
  <p>(Tab was extracted for the post, so here:</p>
  <pre><code>Artur Testme [Tab] Left [Tab] 27.1.2021, 10:34:15)
  </code></pre>
  <p>I open it via fgetcsv and find the word between space and a tab:</p>
  <pre><code>if (($handle = fopen($_FILES[&quot;file&quot;][&quot;test.cvs&quot;], &quot;r&quot;)) !== FALSE) {
      while (($data = fgetcsv($handle, 1000, &quot;;&quot;)) !== FALSE) {   
          preg_match('/(\s)(.*)(\t)/', $data[0], $matches);
          echo $matches[0].&quot;&lt;br&gt;&quot;; 
      }
      fclose($handle);
  } 
  ?&gt;
  </code></pre>
  <p>Output looks like this:
  Testme Left</p>
  <p>I don't understand why I also takes the second word.
  My understanding is, that is should take the word between the space and the tab.
  I hope someone might help me with this.</p>
  <p>Btw: if you find a nice and fast way to sort all the data alphabetically and also throw out the doubles in the attendance report.. this would help me alot and saves me from to much google time. :)</p>
  <p>Thank you!
  Kind regards Daniel</p>