Regex for 0-31: (0[1-9]|[12]d|3[01]) Or if you don't want days with a preceding zero (e.g. 05): ([1-9]|[12]d|3[01])