0

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?

https://regex101.com/r/Pc4McX/1/

Drago
  • 1,755
  • 3
  • 19
  • 30

1 Answers1

0

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)*