fork download
  1. <?php
  2.  
  3. $re = '/(?:-\d+|"[^"]*")(*SKIP)(*F)|\S+/';
  4. $str = "hello there yo\'s -3 \"hey\"";
  5. preg_match_all($re, $str, $matches);
  6. print_r($matches);
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [0] => hello
            [1] => there
            [2] => yo\'s
        )

)