472,344 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Q: validation expression

Hello,
I have this validation expression:

^(?:(?:0?[13578]|1[02])|(?:0?[469]|11)(?!\/31)|(?:0?2)(?:(?!\/3[01]|\/29\/(?:(?:0[^48]|[13579][^26]|[2468][^048])00|(?:\d{2}(?:0[^48]|[13579][^26]|[2468][^048]))))))\/(?:0?[1-9]|[12][0-9]|3[01])\/\d{4}$

This is supposed to match MM/DD/YYYY it is working in all computer except
one in our office. What is problem?
Thanks,
Jim.
Nov 19 '05 #1
5 4815
Hi,
r u getting problem with this expression only or any of your validators are
not
working? If you are getting this problem for all validators then you need
to upgrage your service pack to recent one.

regards,
satish
"JIM.H." wrote:
Hello,
I have this validation expression:

^(?:(?:0?[13578]|1[02])|(?:0?[469]|11)(?!\/31)|(?:0?2)(?:(?!\/3[01]|\/29\/(?:(?:0[^48]|[13579][^26]|[2468][^048])00|(?:\d{2}(?:0[^48]|[13579][^26]|[2468][^048]))))))\/(?:0?[1-9]|[12][0-9]|3[01])\/\d{4}$

This is supposed to match MM/DD/YYYY it is working in all computer except
one in our office. What is problem?
Thanks,
Jim.

Nov 19 '05 #2
Validator in asp.net applications works to match 02/02/2005 and does not give
me problem to submit my data on the screen. However when I go to this one
computer and type the same date on the same field I see validator error
message assuming 02/02/2005 is not right format. I know this date is not the
reason for error in other computers.

"i9arcanes" wrote:
Hi,
r u getting problem with this expression only or any of your validators are
not
working? If you are getting this problem for all validators then you need
to upgrage your service pack to recent one.

regards,
satish
"JIM.H." wrote:
Hello,
I have this validation expression:

^(?:(?:0?[13578]|1[02])|(?:0?[469]|11)(?!\/31)|(?:0?2)(?:(?!\/3[01]|\/29\/(?:(?:0[^48]|[13579][^26]|[2468][^048])00|(?:\d{2}(?:0[^48]|[13579][^26]|[2468][^048]))))))\/(?:0?[1-9]|[12][0-9]|3[01])\/\d{4}$

This is supposed to match MM/DD/YYYY it is working in all computer except
one in our office. What is problem?
Thanks,
Jim.

Nov 19 '05 #3
Hi Jim,

You have run into a common problem for ASP.NET users: everyone misses the
fact that the CompareValidator handles date validation. In fact, it actually
determines if you have a real, legal date. Just set its
Operator=DataTypeCheck and Type=Date.

It follows the CultureInfo object of the current thread to get the
ShortDatePattern ("MM/dd/yyyy"). If it has the wrong one, see the <@ Page
Culture=> property to set up the desired cultureInfo object.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:75**********************************@microsof t.com...
Validator in asp.net applications works to match 02/02/2005 and does not
give
me problem to submit my data on the screen. However when I go to this one
computer and type the same date on the same field I see validator error
message assuming 02/02/2005 is not right format. I know this date is not
the
reason for error in other computers.

"i9arcanes" wrote:
Hi,
r u getting problem with this expression only or any of your validators
are
not
working? If you are getting this problem for all validators then you
need
to upgrage your service pack to recent one.

regards,
satish
"JIM.H." wrote:
> Hello,
> I have this validation expression:
>
> ^(?:(?:0?[13578]|1[02])|(?:0?[469]|11)(?!\/31)|(?:0?2)(?:(?!\/3[01]|\/29\/(?:(?:0[^48]|[13579][^26]|[2468][^048])00|(?:\d{2}(?:0[^48]|[13579][^26]|[2468][^048]))))))\/(?:0?[1-9]|[12][0-9]|3[01])\/\d{4}$
>
> This is supposed to match MM/DD/YYYY it is working in all computer
> except
> one in our office. What is problem?
> Thanks,
> Jim.
>
>

Nov 19 '05 #4
Peter, thank for the reply. I did not know that I would validate only
MM/dd/yyyy format with date validator. I am new in asp.net. Now, my
applications have many regular expression validator in many applications. If
it is cultural setting issue, is there anything I can do in the control panel
to get regular expression working. We have more than 20 computers, I still do
not understand why only one computer is the problem.
"Peter Blum" wrote:
Hi Jim,

You have run into a common problem for ASP.NET users: everyone misses the
fact that the CompareValidator handles date validation. In fact, it actually
determines if you have a real, legal date. Just set its
Operator=DataTypeCheck and Type=Date.

It follows the CultureInfo object of the current thread to get the
ShortDatePattern ("MM/dd/yyyy"). If it has the wrong one, see the <@ Page
Culture=> property to set up the desired cultureInfo object.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:75**********************************@microsof t.com...
Validator in asp.net applications works to match 02/02/2005 and does not
give
me problem to submit my data on the screen. However when I go to this one
computer and type the same date on the same field I see validator error
message assuming 02/02/2005 is not right format. I know this date is not
the
reason for error in other computers.

"i9arcanes" wrote:
Hi,
r u getting problem with this expression only or any of your validators
are
not
working? If you are getting this problem for all validators then you
need
to upgrage your service pack to recent one.

regards,
satish
"JIM.H." wrote:

> Hello,
> I have this validation expression:
>
> ^(?:(?:0?[13578]|1[02])|(?:0?[469]|11)(?!\/31)|(?:0?2)(?:(?!\/3[01]|\/29\/(?:(?:0[^48]|[13579][^26]|[2468][^048])00|(?:\d{2}(?:0[^48]|[13579][^26]|[2468][^048]))))))\/(?:0?[1-9]|[12][0-9]|3[01])\/\d{4}$
>
> This is supposed to match MM/DD/YYYY it is working in all computer
> except
> one in our office. What is problem?
> Thanks,
> Jim.
>
>


Nov 19 '05 #5
Hi Jim,

Indeed you sound like you are inexperienced.

Regular expressions are not culture sensitive. Regular expressions are a
concept that matches a string to a pattern.
With dates, you are trying to match a string to a date value. A date value,
as you know, has rules for numeric ranges on each "part". While a regular
expression can detect a value date pattern, it really cannot tell that the
month is February and the day is 31.

As you explore .net, you will start using their DateTime object to manage
dates. It is a fantastic class with a rich set of properties and methods. It
can determine that a date is illegal. It has Parse() methods to convert
strings to dates or throw exceptions if the date is illegal.

The CompareValidator uses the DateTime object to do this. It uses a similar
JavaScript Date object on the client-side. That's why you should simply use
the CompareValidator.

The DateTime object converts strings to dates following the CultureInfo
object of the current thread. I've told you to use the <@ Page Culture=> tag
to define the culture you like. That is embedded on the page so as it
migrates to different servers, they will all use the same rules.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:32**********************************@microsof t.com...
Peter, thank for the reply. I did not know that I would validate only
MM/dd/yyyy format with date validator. I am new in asp.net. Now, my
applications have many regular expression validator in many applications.
If
it is cultural setting issue, is there anything I can do in the control
panel
to get regular expression working. We have more than 20 computers, I still
do
not understand why only one computer is the problem.
"Peter Blum" wrote:
Hi Jim,

You have run into a common problem for ASP.NET users: everyone misses the
fact that the CompareValidator handles date validation. In fact, it
actually
determines if you have a real, legal date. Just set its
Operator=DataTypeCheck and Type=Date.

It follows the CultureInfo object of the current thread to get the
ShortDatePattern ("MM/dd/yyyy"). If it has the wrong one, see the <@ Page
Culture=> property to set up the desired cultureInfo object.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:75**********************************@microsof t.com...
> Validator in asp.net applications works to match 02/02/2005 and does
> not
> give
> me problem to submit my data on the screen. However when I go to this
> one
> computer and type the same date on the same field I see validator error
> message assuming 02/02/2005 is not right format. I know this date is
> not
> the
> reason for error in other computers.
>
>
>
> "i9arcanes" wrote:
>
>> Hi,
>> r u getting problem with this expression only or any of your
>> validators
>> are
>> not
>> working? If you are getting this problem for all validators then you
>> need
>> to upgrage your service pack to recent one.
>>
>> regards,
>> satish
>>
>>
>> "JIM.H." wrote:
>>
>> > Hello,
>> > I have this validation expression:
>> >
>> > ^(?:(?:0?[13578]|1[02])|(?:0?[469]|11)(?!\/31)|(?:0?2)(?:(?!\/3[01]|\/29\/(?:(?:0[^48]|[13579][^26]|[2468][^048])00|(?:\d{2}(?:0[^48]|[13579][^26]|[2468][^048]))))))\/(?:0?[1-9]|[12][0-9]|3[01])\/\d{4}$
>> >
>> > This is supposed to match MM/DD/YYYY it is working in all computer
>> > except
>> > one in our office. What is problem?
>> > Thanks,
>> > Jim.
>> >
>> >


Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Geoff Soper | last post by:
I've been looking for a simple way of checking that a string is an e-mail address. I don't need to check if the address exists, just if the format...
3
by: arc | last post by:
I have a server object that performs zipcode validation based on zipcode entered in the web form. Ideally this should work as follows: Once the...
18
by: Steve | last post by:
Hi I have a really weird problem and any assistance would be welcome. I have developed an app in Access 2002. The app runs perfectly on the...
6
by: Chuck | last post by:
A97. A database has a table: tblA which has a single text field, B. It is a primary field, indexed and no duplicates. It is used as a lookup for...
2
by: ticars | last post by:
I have a telephone number user control in which I need to validate the data entered (Required field validation and regular expression validation). ...
2
by: Jeff | last post by:
hey asp.net 2.0 I have a textbox on my webpage. I want to validate that the user has entered a number and not text. So I added a...
5
by: paul_zaoldyeck | last post by:
does anyone know how to validate an xml file against multiple defined schema? can you show me some examples? i'm making here an xml reader.. ...
2
by: pintu | last post by:
Hi I am writing a validation expression for the followings 1)EPF/chp15_v3.htm#p33 or 2)EPF/chp15_v3.htm I wrote the validation expression as...
2
by: jack | last post by:
Im a new bee in validation Im just in the design phase of the project and not thinking about having a saperate validaion block. Just browsed...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

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.