Answer the question
In order to leave comments, you need to log in
Why doesn't the regular expression find the second match?
$str = '1.9.2017'; // или 10.9.2017 или 1.10.2017
$str = preg_replace('/(^|\.)(\d\.)/', '${1}0$2', $str);
var_dump($str); // 01.9.2017, а ожидалось, что будет 01.09.2017
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question