fork(19) download
  1. <?php
  2. $str = 'This is the test string with 22/12/2012. 25/10/2013 could anywhere in the string';
  3. $repl = preg_replace('~(\d{2})/(\d{2})/(\d{2,4})~', '$1-$2-$3', $str);
  4. echo "$repl\n";
  5. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
This is the test string with 22-12-2012. 25-10-2013 could anywhere in the string