Skip to content

Instantly share code, notes, and snippets.

@tristanls
Last active September 6, 2021 14:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tristanls/356ce5aea0054b770d49 to your computer and use it in GitHub Desktop.
Save tristanls/356ce5aea0054b770d49 to your computer and use it in GitHub Desktop.
ISO-8601 Duration Regex
var iso8601durationregex = /^P([0-9]+(?:[,\.][0-9]+)?Y)?([0-9]+(?:[,\.][0-9]+)?M)?([0-9]+(?:[,\.][0-9]+)?D)?(?:T([0-9]+(?:[,\.][0-9]+)?H)?([0-9]+(?:[,\.][0-9]+)?M)?([0-9]+(?:[,\.][0-9]+)?S)?)?$/
@tristanls
Copy link
Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment