I'd like to write a regular expression for matching both HH:MM:SS and MM:SS.
Match
- 99:43:22
- 1:43:22
- 01:43:22
- 1:43:22
- 43:22
so I've tried
(([0-5]?[0-9]):([0-5]?[0-9]))|(([0-9]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9]))
What I wanted to add was just a single OR(|) syntax with two time regex.
But it doesn't match for HH:MM:SS
what am I missing?
I've already looked into those articles: