File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure 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
  • 0
  • 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
  • 0
  • 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?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic