note 105275 rejected from function.preg-replace by thiago
| From: | thiago@php.net | Date: | Sun, 07 Aug 2011 00:35:46 +0000 |
| Subject: | note 105275 rejected from function.preg-replace by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182287@lists.php.net to get a copy of this message | ||
Note Submitter: davincy at qq dot com
----
output: April1, 2003
the example is wrong.
try this,
<?php
$string = "April 15, 2003";
$pattern = "/(\w+)(\d+), (\d+)/i";
$replacement = "\${1}1,\$3"; // look at this
print preg_replace($pattern, $replacement, $string);
?>