fork download
  1. <?php
  2.  
  3. $re = '/(-?\w+:)"([^"]+)"/';
  4. $str = 'title -launch category:technology -tag:news -tag:"outer space"$';
  5. $result = preg_replace($re, '"$1$2"', $str);
  6. echo "The result of the substitution is ".$result;
Success #stdin #stdout 0.01s 82624KB
stdin
Standard input is empty
stdout
The result of the substitution is title -launch category:technology -tag:news "-tag:outer space"$