1
Answer

server side control

Photo of dc

dc

12y
1.1k
1
In a C# 2010 web application, I want to add a server side regular expression value that can edit a date in the following format:

mm/dd/yyyy where mm is month, dd is day, and yyyy is year. I want the user to be required to enter the backslashes. From what I have seen on the internet, the following  2 examples would have the code that works:

1.   (0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d)

2 ^(0[1-9]|1[012])[/](0[1-9]|[12][0-9]|3[01])[/](19|20)\d\d$

Based upon the above, can you tell me the following:

1. Which method would work and why?

2. If neither method would work what would you recommend that would work?

3. From the examples above, what does [- /.] stand for? I know the dot is only one character and the / is the character that is being looked for? However what does the dash followed by a space mean? Is this the same meaning as [/]?

4. In the above examples you can see 1[012]. Does that mean that the first digit must 1 and the second digit can be either 0 or 1 or 2?

5. When looking at the regular expressions, is there a way to tell what the pattern being matched against means? Basically is there a way to tell what the regular expression means by using a tool like the .net debugger?

Answers (1)

0
Photo of Majid Kamali
NA 315 213.4k 14y
Where should I declare this array or list that can access from both forms?
0
Photo of Koteswararao Mallisetti
NA 1.1k 468.9k 14y
object is super class for every thing in .net so we can take all that check boxes into object arry and in the destination form we explicitly covert that objects into chekboxes other wise use generics concept

list<checkbox> cklist= new list<checkBox>();