473,326 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

XMLspy - dd/mm/yy Pattern problem

108 100+
Greetings,

I was looking for a regular expression to validate dates in the format dd/mm/yy including leap year validation.

I found a regular expression from http://regexlib.com (see below)

Expand|Select|Wrap|Line Numbers
  1. ^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/(\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/(\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/(\d{2}))|(29\/02\/((0[48]|[2468][048]|[13579][26])|(00))))$
Which I then formatted taking off the start and end tags and also changing \/ which i believe represents a forward slash to / as its not support by xmlspy.

This leaves me with the following :-

Expand|Select|Wrap|Line Numbers
  1. (((0[1-9]|[12]\d|3[01])/(0[13578]|1[02])/(\d{2}))|((0[1-9]|[12]\d|30)/(0[13456789]|1[012])/(\d{2}))|((0[1-9]|1\d|2[0-8])/02/(\d{2}))|(29/02/((0[48]|[2468][048]|[13579][26])|(00))))
However when entering my dd/mm/yy xmlspy points to the / not being valid in my date 01/07/07

Can anyone help me to resolve this?

Thanks
Rob
Oct 26 '07 #1
5 5763
jkmyoung
2,057 Expert 2GB
Your pattern looks right.
It could even be shortened to:
Expand|Select|Wrap|Line Numbers
  1. ((31/(0[13578]|1[02])/(\d{2}))|((0[1-9]|[12]\d|30)/(0[13456789]|1[012])/(\d{2}))|((0[1-9]|1\d|2[0-8])/02/(\d{2}))|(29/02/((0[048]|[2468][048]|[13579][26]))))
Oct 26 '07 #2
robtyketto
108 100+
Thanks for the reply I replaced my pattern with the one you posted and all works !!

Very happy : - )

Thanks again
Rob
Oct 27 '07 #3
robtyketto
108 100+
Ok so now I decided to have the date field as dd/mm/yy hh:mm

and found the regular expression list below on the web (does dd/mm/yy or dd/mm/yy hh:mm:ss, modifying \/ to / so xmlspy can process the forward slash.

Expand|Select|Wrap|Line Numbers
  1. <xs:pattern value="((((([0-1]?\d)|(2[0-8]))/((0?\d)|(1[0-2])))|(29/((0?[1,3-9])|(1[0-2])))|(30/((0?[1,3-9])|(1[0-2])))|(31/((0?[13578])|(1[0-2]))))/((19\d{2})|([2-9]\d{3}))|(29/0?2/(((([2468][048])|([3579][26]))00)|(((19)|([2-9]\d))(([2468]0)|([02468][48])|([13579][26]))))))\s(([01]?\d)|(2[0-3]))(:[0-5]?\d){2}"/>
Again when creating an xml file from the schema it complains at the forward slash. Im left confused and frustrated, the sheer size of his makes it difficult to read.

If anyone has a regular expression for dd/mm/yy hh:mm (no seconds!) I would be very grateful

Thanks
Rob
Nov 1 '07 #4
jkmyoung
2,057 Expert 2GB
You should just be able to delete the {2} at the end, since that is for both minutes and seconds.
Assuming you always have 2 digits hours and minutes,

((31/(0[13578]|1[02])/(\d{2}))|((0[1-9]|[12]\d|30)/(0[13456789]|1[012])/(\d{2}))|((0[1-9]|1\d|2[0-8])/02/(\d{2}))|(29/02/((0[048]|[2468][048]|[13579][26]))))(([01]\d)|(2[0-3])):[0-5]\d
Nov 1 '07 #5
robtyketto
108 100+
Thanks again, I realised it was the same issue as before I had the element type as xs:datetime and not xs:string.

xs:datetime I suppose does not expect a forward slash /

Cheers
Rob
Nov 1 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Lars | last post by:
Hi all, I suspect this may be a bug in XMLSpy, since IE seems to validate this XML successfully. Maybe someone here has run into this and can tell me. Problem: When I try to validate the XML...
1
by: kk | last post by:
I can't figure out why XMLSpy can't validate pass the following schema segment: <?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="http://www.mydomain.com/myschema"...
1
by: Alexey V. Dmitriev | last post by:
Hi, ALL! Try to parse my XML doc with Xerces2-J (v.2.2.0), but ErrorHandler return errors a course of this proccess. All needed features were turn on. BTW, validation under XMLSpy tool passed...
0
by: Ray Tayek | last post by:
hi, trying to convert some csv files into xsml and pulling a few hairs out :(. using the files below. a java program will parse the csv and take care of strange names and notes that line breaks in...
2
by: Patrick J. Maloney | last post by:
I received a file from a business partner. I ran it through XercesJ and it choked on the following element: <wcb-case-number>0</wcb-case-number> To debug this issue, I loaded it into XMLSPY...
2
by: Jan Mueller | last post by:
Hi all, I don't know whether this is the right group, let me know :-). I tried to open this XML file (with internal DTD) with XMLSpy 2005. I guess some of you also use this tool. ...
14
by: Mat| | last post by:
Hello :-) I am learning XPath, and I am trying to get child nodes of a node whose names do *not* match a given string, e.g : <dummy> <example> <title>Example 1</title> <body>this is an...
6
by: quanghoc | last post by:
Hi all, I used XMLSpy to validate my XML but it catched one error at a time. Is there anyway to make XMLSpy to catch all errors at once. If XMLSpy does not have this feature, what software out...
1
by: Blue Doze | last post by:
Hello, I have the following XML schema fragment: <xs:complexType name="type.1"> <xs:simpleContent> <xs:restriction base="ns:type"> <xs:simpleType> <xs:restriction...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.