3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/\b\d{1,2}(?:\.\d{1,2}\.|\h+\p{Lu}\p{Ll}+\h+)(?:\d\d|\d{4})\b/u'; $str = '01.01.2022 1.01.2022 1.1.2022 1.1.22 ... Now I have a date format like this: 25 März 2023 or 25 March 2023'; preg_match_all($re, $str, $matches); print_r($matches[0]);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
Array ( [0] => 01.01.2022 [1] => 1.01.2022 [2] => 1.1.2022 [3] => 1.1.22 [4] => 25 März 2023 [5] => 25 March 2023 )

preferences:
81.1 ms | 407 KiB | 5 Q