Last active
August 28, 2020 12:51
-
-
Save allensarkisyan/5441601 to your computer and use it in GitHub Desktop.
SMPTE Time Code RegExp Pattern for matching SMPTE time codes that have a frame rate of 23.98, 24, 25, 29.97, or 30.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Allen Sarkisyan | |
* @copyright 2013 | |
* @license Open Source MIT License | |
*/ | |
/** | |
* Assumes the frame rate is 23.98, 24, 25, 29.97 NDF, or 30 | |
* | |
* This pattern basically matches the hours being less then 24, the minutes, and seconds | |
* being less than 60, the frame count being less than 30, and the existence of 3 colons. | |
* might also rewrite this in the future to support semi colons | |
*/ | |
var isValidSMPTETimeCode = new RegExp(/(^(?:(?:[0-1][0-9]|[0-2][0-3]):)(?:[0-5][0-9]:){2}(?:[0-2][0-9])$)/); | |
// var isValidSMPTETimeCode = /(^(?:(?:[0-1][0-9]|[0-2][0-3]):)(?:[0-5][0-9]:){2}(?:[0-2][0-9])$)/; | |
// isValidSMPTETimeCode.test('00:12:11:23') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With semi-colons:
^([0-1][0-9]|[0-2][0-3]):([0-5][0-9]):([0-5][0-9])[:;]([0-6][0-9])$