This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Creating a regex to match date string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Creating a regex to match date string" Watch "Creating a regex to match date string" New topic
Author

Creating a regex to match date string

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

Here are examples of my input string:

I want to validate this using XML Schema. So I trying to create a simpleType derived from xsd:String but I'm having some problems. Can anyone help? What is wrong with this simpleType? Why can't it meet my requirements stated above?


Regards,

Pho
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Instead of

[(Mon)(Tues)(Wednes)(Thurs)(Fri)(Satur)(Sun)]

try

(Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)

And similarly for other elements you wish to join with "or". The only time you should use braces [] or "or" something is when you're talking about single characters. E.g. [123] means 1 or 2 or 3, fine. But the whole expression is just one character (which can be one of thee possibilities. If you want to "or" things that are longer than one character, you need | instead.


"I'm not back." - Bill Harding, Twister
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

Hey Jim,

Thanks. It's working fine now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating a regex to match date string
 
Similar Threads
XML won't validate against XSD
XSD - Element with value always
correct answer
how to define array of stations in LoginResponse complex type
Rational Application Developer V7 - Webservice