- print_r: documentation ( source)
- preg_match_all: documentation ( source)
<?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]);