$string='April15,2003';$pattern='/(\w+)(\d+),(\d+)/i';$replacement='${1},${3}';echo preg_replace($pattern,$replacement,$string);?>
The result of this expression is april1,2003
Cause: (\w+) can match April15 completely, but because (\d+) is behind (\w+), in order to be able to match defined rules, (\w+) matches April1, (\d+) matches 5
You can change the expression to avoid this situation such as:
$pattern = '/([A-z]) (\d+), (\d+)/I ';
Welcome to learn PHP to join PHP Beginners Group 225128823
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the regular expression \w and \d doubts, including the regular expression aspects of the content, I hope that the PHP tutorial interested in a friend helpful.