fork download
  1. <?PHP
  2. # answer: http://o...content-available-to-author-only...e.jp/qa/q7056347.html
  3.  
  4. while ($line = fgets(STDIN)){
  5. if (preg_match('/\A\d{3}-(?:[A-Z]-)?\d{3}\Z/', $line)){
  6. echo $line;
  7. }
  8. }
  9. ?>
Success #stdin #stdout 0s 13112KB
stdin
123-456
1234-567
123-4567
1234-5678
123-A-456
123-A456
stdout
123-456
123-A-456