I’m attempting to match a timecode in the format of “0000” to “2459”. How can I match numbers in a specific range, so that I could specifically match all numbers between 0 and 24 and all numbers between 0 and 59, and nothing greater or lesser?
I know how to match each individual digit, but that won’t do what I want because for example
/[0-2][0-4]/
would capture numbers 0-4, 10 – 14, and 20-24, missing those in between. So I want to capture all inclusive for multiple digits.
The following should do the trick:
Explanation:
?:makes the parentheses non-capturing.