12 lines
458 B
Markdown
12 lines
458 B
Markdown
# Find the time as hh:mm or hh-mm
|
|
|
|
The time can be in the format `hours:minutes` or `hours-minutes`. Both hours and minutes have 2 digits: `09:00` or `21-30`.
|
|
|
|
Write a regexp to find time:
|
|
|
|
```js
|
|
let regexp = /your regexp/g;
|
|
alert( "Breakfast at 09:00. Dinner at 21-30".match(regexp) ); // 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.
|