fork(4) download
  1. <?php
  2.  
  3. $re = '/\w+(?:[- ]\w+)*/';
  4. $str = "Some Words - Other Words (More Words) Dash-Binded-Word";
  5. preg_match_all($re, $str, $matches);
  6. print_r($matches[0]);
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Some Words
    [1] => Other Words
    [2] => More Words
    [3] => Dash-Binded-Word
)