473,467 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XMLspy - dd/mm/yy Pattern problem

108 New Member
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 5775
jkmyoung
2,057 Recognized Expert Top Contributor
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 New Member
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 New Member
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 Recognized Expert Top Contributor
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 New Member
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.