Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regular Expression for date
#1
Solved: 11 Years, 3 Months, 1 Week ago
Can you anyone tell a regular expression to check that a date entered has a valid format of MM/DD/200Y ?
Reply
#2
Solved: 11 Years, 3 Months, 1 Week ago
(0[1-9]|1[012])[//](0[1-9]|[12][0-9]|3[01])[//]200[0-9]$
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 11 Years, 3 Months, 1 Week ago
Hi Ankur,

i am regular user of your blog.I found it very useful.I am learning QTP...
Can u please explain this (0[1-9]|1[012]) expression.

Thank you..
Reply
#4
Solved: 11 Years, 3 Months, 1 Week ago
well...the OP has asked for the format MM/DD/200Y

(0[1-9]|1[012]) --- This covers the MM part of the whole expression. [1-9] means any numeral between 1 and 9. [012] means either 0 or 1 or 2

| separator stands for "OR".

So when you group the whole expression it mean either look out for month from 01 to 09 or 10 or 11 or 12 month. So this covers the whole range of months available (from Jan to Dec)
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to click on a date button? Parthasit033 0 1,930 09-06-2017, 01:49 AM
Last Post: Parthasit033
  Need Any digit in xpath path using Regular expression Priyam 1 3,473 10-05-2016, 11:05 AM
Last Post: Ankur
  Regular expression to read two words in lowercase, uppercase and with and without spa sarahq49 1 3,342 04-09-2015, 01:56 AM
Last Post: sarahq49
  Regular expression and script optimisation Padmavathy 1 3,798 03-30-2015, 11:46 AM
Last Post: supputuri
  Regular expression in descriptive programming testernc 1 16,551 12-08-2014, 06:38 PM
Last Post: anshika.agarwal

Forum Jump:


Users browsing this thread: 1 Guest(s)