Find the time as hh:mm or hh-mm
The time can be in the format
hours-minutes. Both hours and minutes have 2 digits:
Write a regexp to find time:
let reg = /your regexp/g; alert( "Breakfast at 09:00. Dinner at 21-30".match(reg) ); // 09:00, 21-30
P.S. In this task we assume that the time is always correct, there’s no need to filter out bad strings like “45:67”. Later we’ll deal with that too.
Please note that the dash
'-' has a special meaning in square brackets, but only between other characters, not when it’s in the beginning or at the end, so we don’t need to escape it.