fork(1) download
  1. <?php
  2.  
  3. if ($argc < 2) {
  4. die("usage: {$argv[0]} <string> [ <string> ... ]");
  5. }
  6.  
  7. $regex = '/卡拉\w+可夫/u';
  8. for ($i = 1; $i < $argc; ++$i) {
  9. $mres = preg_match($regex, $argv[$i], $matches);
  10. echo "preg_match claims {$mres} match for $regex in {$argv[$i]}\n";
  11. print_r($matches);
  12. }
  13.  
Success #stdin #stdout 0.01s 20568KB
stdin
卡拉可夫 卡拉稀泥可夫 卡拉OK可夫 卡拉OK和稀泥可夫 卡拉_可夫 卡拉*可夫
stdout
1
Array
(
    [0] => prog.php
)
usage: prog.php <string> [ <string> ... ]