N
N
Nikita Ignatenkov2017-09-25 23:57:34
PHP
Nikita Ignatenkov, 2017-09-25 23:57:34

Parse string with PHP regular expression?

You need to write a regular expression to get the year, month, day, hour, minute and second
. The data array is
01:00:05 07/21/2017 (known full date with time ) 01:05
:07/21/2017 (unknown seconds)
01:21.07. 2017 (minutes unknown)
07/21/2017 (date only)
07/2017 (month and year known)
2017 (year known)
01: (
hour and minutes known)
01:05:17 (full time known)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2017-09-26
@zkelo

^(((\d{2,2})?:?(\d{2,2})?:?(\d{2,2})?)?\s?((\d{2,2})?\.?(\d{2,2})?\.?(\d{2,4})?)?)$

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question