I have the following string:
22/04/2020 14:10 by example@example.com
And I wrote the following regex:
^(\d{2,4}\/?)+
Why does group 1 only match the last part of the date and not the whole date, and how can I fix this?
I have the following string:
22/04/2020 14:10 by example@example.com
And I wrote the following regex:
^(\d{2,4}\/?)+
Why does group 1 only match the last part of the date and not the whole date, and how can I fix this?
Note that regex store all matches in the array - firstly check in your code all matches. I think that the data that you need - already matched - you just need to store it. Following the Regex101 - Full match - will be your arr[0]. If you are using PHP - check this regex-tester = https://www.phpliveregex.com/
My regex :
^(\d+\W)*