Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes XML and Related Technologies and the fly likes XML Schema regex to match days of the month Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML Schema regex to match days of the month" Watch "XML Schema regex to match days of the month" New topic
Author

XML Schema regex to match days of the month

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

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


Regards,

Pho
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

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?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML Schema regex to match days of the month
 
Similar Threads
What's wrong in my regex comparison function ?
Regular Expression requred to get Java class names from text file
Regular Expression Question
doubt on group() in Matcher class
Compiling blank lines patterns using regex