Thank you Jesse, for trying to help. Before posting here I have already
checked regexlib.com with no success. But today I took Alessandro Olivi
pattern and corrected it a little bit. So I have following pattern working
very well
^(((0[1-9]|[12][0-9]|3[01])([.])(0[13578]|10|12)([.])(\d{4}))|(([0][1-9]|[12][0-9]|30)([.])(0[469]|11)([.])(\d{4}))|((0[1-9]|1[0-9]|2[0-8])([.])(02)([.])(\d{4}))|((29)(\.)(02)([.])([02468][048]00))|((29)([.])(02)([.])([13579][26]00))|((29)([.])(02)([.])([0-9][0-9][0][48]))|((29)([.])(02)([.])([0-9][0-9][2468][048]))|((29)([.])(02)([.])([0-9][0-9][13579][26])))
I am putting current date on page load and limited length of my date text
field to 10 charachters. So every wrong entry is prevented by regular
expression validator.
I think this is "perfect" as much as it can be in case you are not using
third party controls made to be sold.
[quoted text, click to view] "Jesse Houwing" wrote:
> Hello Amir,
>
> > I need regular validation expression in order to check entry of date
> > in
> > "european" format i.e. 24.09.2007 . Anybody could help?
> > So far I have simple expression like this
> > (\d{2}\.)(\d{2}\.)(\d{4})
> >
> > This expression does not prevent entry of 45.23.2006 for example
>
>
> If you need more fancy validation, either have alook at Peter's Data package
> (
http://www.peterblum.com/) or resort to server side validation.
>
> There are also regular expressions which will in fact match a perfect date
> including leap years and other variations, but they are so large and usually
> in the US format that it will take quite a bit of knowledge of regular expressions
> to rework them. You might be lucky and find what you're looking for in the
> Regular Expression Library (
http://www.regexlib.net/). I'd reccommend against
> them as in my experience, you will need to support alternative formats in
> the future. Having one regex will be a serious problem by then.
>
> --
> Jesse Houwing
> jesse.houwing at sogeti.nl
>
>