en.javascript.info/9-regular-expressions/08-regexp-character-sets-and-ranges/2-find-time-2-formats/solution.md
Ilya Kantor f21cb0a2f4 WIP
2019-09-04 15:44:48 +03:00

344 B

Answer: pattern:\d\d[-:]\d\d.

let reg = /\d\d[-:]\d\d/g;
alert( "Breakfast at 09:00. Dinner at 21-30".match(reg) ); // 09:00, 21-30

Please note that the dash pattern:'-' 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.