[Solved] How to select a date using regex [closed]


The .* will match everything after the :, including the space and the time. To get just the date, be more specific than a wildcard that matches any character. Use this pattern:

#(\d{2}/\d{2}/\d{4})#

Capture group #1 will contain the date.

You tagged it as only regex and not php, but in PHP that would be:

preg_match('#(\d{2}/\d{2}/\d{4})#', $string_containing_the_sentence)

and the date will be assigned to $1.

13

solved How to select a date using regex [closed]