This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML Schema regex to match days of the month

 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently I am using this regex to match for the days of the month 1,2,...31

This regex is incorrect because it allows days 32-39. Does anyone have suggestions to improve this?

Thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a reason why you haven't used a dateTime data type? That includes date validation as part of the schema sepcification.

The reason I suggest this is there is no regular expression that will correctly validate a day of month value. Suppose you write one that does only allow values between 1 and 31, what happens when February comes along?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic