how to write regular expression for Date field?

Answers were Sorted based on User's Feedback



how to write regular expression for Date field?..

Answer / raghu

To apply Regular expression for Date we have to split months
1) [0][1-9] because it accepts 01,02,...09 as months

2) [1][1-2] and this is for 10th,11th, 12th months

Now The Regular expression for whole date format is as follows

Example MM/DD/YY

[0][1-9][/][0-9][0-9][/][0-9][0-9] for 1 to 9 months
[1][1-2][/][0-9][0-9][/][0-9][0-9] for 10 to 12 months

Is This Answer Correct ?    0 Yes 0 No

how to write regular expression for Date field?..

Answer / ratikanta

[0][1-9]|[1-2][0-9]|[3][0-1]-[0][1-9]|[1][0-2]-[1-9][0-9][0-9][0-9]

Is This Answer Correct ?    0 Yes 0 No

how to write regular expression for Date field?..

Answer / naresh

30/12/12 format


(0-3)(0-3)/(0-1)(0-9)/(0-9)(0-9)

Is This Answer Correct ?    0 Yes 0 No

how to write regular expression for Date field?..

Answer / biswarup

dd-mm-yy format then it will be

[[0-3][0-9]]&&[^3[2-9]^00]-[[01][0-9]]&&[^1[3-9]^00]-\d{2}

please rectify me if you find it to be incorrect or with
some minor error, as i'm not completely sure about the part
after '&&', i mean, the error is not in the logic but in the
syntax of using the AND and OR operators.

Is This Answer Correct ?    7 Yes 8 No

how to write regular expression for Date field?..

Answer / rajesh

[1-9]|1[0-2]/[1-9]|[1-2][0-9]|3[0-1]/19[0-9][0-9]|2[0-9][0-9][0-9]

This works for 1900 to 2999

Is This Answer Correct ?    0 Yes 1 No

how to write regular expression for Date field?..

Answer / rajesh vanamala

MM/DD/YYYY

[0][1-9]|[1][0-2]/[0][1-9]|[1][0-9]|[2][0-9]|[3][0-1]/[1-9][0-9][0-9][0-9]

Is This Answer Correct ?    1 Yes 2 No

how to write regular expression for Date field?..

Answer / a kiran kumar

for example date formate is dd/mm/yy
than [0-3][0-9]/[0-1][0-2]/[0-9][0-9]

Is This Answer Correct ?    14 Yes 18 No

how to write regular expression for Date field?..

Answer / sow

[0-3][0-1]/[0-1][0-2]/200[0-9]

This would take only 2001 to 2009. It will not accept 1999.

Is This Answer Correct ?    2 Yes 7 No

how to write regular expression for Date field?..

Answer / ashok

For example date format is dd/mm/yy

than [0-3][0-9]/[0-1][0-9]/[0-9][0-9]

Is This Answer Correct ?    4 Yes 15 No

how to write regular expression for Date field?..

Answer / satyanarayana

If the date field is in the following format

'mm/dd/yy'
[0-1][0-9]/[0-3][0-9]/200[0-9]

Is This Answer Correct ?    4 Yes 17 No

Post New Answer

More QTP Interview Questions

What are the different recording modes?

0 Answers  


Explain about the test fusion report of quicktest professional (qtp)?

0 Answers  


What does it mean when a check point is in red color? What do you do?

0 Answers  


How to export QTP results to an .xls file?

10 Answers   IBM,


if my application shows 100 records and in my database having 200 records how i can validate using QTP tool?plz exp. in detail?

2 Answers   Wipro,


Hi .. i want to write the script for the combo nox list . For example if any combo box having a multipul itme. So how can i retrive each item for each iteration ? help me out .

2 Answers  


if Object repository contain x and y properties. we do not know whether they are mandatory or assistive properties. While executing the script qtp will use both the properties or only sufficient properties to identify the object. It means it use OR (or) AND

8 Answers   ADP,


What is the difference between Keyword Driven test and Data Driven test?

0 Answers  


I used child objects to get the no of weblist present in the weblist.now i need to select the items present in each weblist ?How to do so

0 Answers  


Suggest and Define a solution for an application whose objects are not recognized by UFT?

0 Answers  


In QTP, Which are the concepts are needed to do Functional testing and Regression testing?

3 Answers   IBM,


difference Between Call Run action and copy of action?

3 Answers   Quest,


Categories