Answer the question
In order to leave comments, you need to log in
How to make a regular expression with remember but exclude part?
Hello!
https://regex101.com/r/FnawtN/1
In short, there are line options that indicate days, hours, and minutes (duration):
Day 5 1:23
pm 5:44 pm
12 pm 5:00 pm
[
'days' => 5,
'hours' => 1,
'minutes' => 23,
]
Answer the question
In order to leave comments, you need to log in
Is it possible to make sure that there are no empty values in the array?
[0-9]+[\s]{0,}д
[0-9]+[\s]{0,}ч
[0-9]+[\s]{0,}м
if(!preg_match('/[0-9]+[\s]{0,}д/ismu', $string)){
$days= 0;
}
[
'days' => $days,
'hours' => $hours,
'minutes' => $minutes,
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question