Skip to content

Instantly share code, notes, and snippets.

@grambas
Last active Jan 15, 2019
Embed
What would you like to do?
REGEX

Validate string for PHP DateInterval. (P or PT, then any number with no leading zeros. At the end H for hour interval and W,D or M for weeks, days and months)

(P((0|[1-9][0-9]*))(W|D|M)|PT((0|[1-9][0-9]*))H)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment