Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Sir,

What is the meaning of this code \s*\d{2}[\:]\s*\d{2} This code is used to check the time but I want to understand its meaning what is written please give any path so that I can understand this code
Posted
Updated 20-Nov-11 23:41pm
v2

It is a regular expression: you can learn about them by starting here[^] and reading through some of the tutorials.
 
Share this answer
 
Comments
Prashant Srivastava LKO 21-Nov-11 5:00am    
Thank u Sir
This is a so called 'regular expression' (RegEx).
Just have a look at this :http://en.wikipedia.org/wiki/Regular_expression[^]

Your RegEx will match when:

0 or more whitespaces (\s*)
are followed by
exactly two digits (\d{2})
followed by ':'
followed by 0 or more whitespaces (\s*)
followed by
exactly two digits (\d{2})

The syntax and behaviour of regEx are depending on the underlaying regEx engine. So there are quite big differences in using regEx in Perl, PHP or C#.
So be carefull with examples from other programming languages.
 
Share this answer
 
v2
Comments
Prashant Srivastava LKO 21-Nov-11 5:11am    
Thank u Sir
Amir Mahfoozi 21-Nov-11 5:42am    
+5 I agree with you
Have a look at this article to get started in Regular Expression:

An Introduction to Regular Expressions[^]


hope it helps :)
 
Share this answer
 
this is one type of Regular expression.
You can get the different type of regular expression from the site:

http://regexlib.com/UserPatterns.aspx?authorid=0ebe8f93-b71b-4d1c-bfc2-0b583c464641[^]
 
Share this answer
 
Have a look at below CodeProject Articles on "Regular Expressions".

The 30 Minute Regex Tutorial

Learn Regular Expressions (RegEx) with Ease
 
Share this answer
 
Comments
Uday P.Singh 21-Nov-11 6:44am    
5ed :)
RaisKazi 21-Nov-11 7:29am    
Thank you Uday.
Prashant Srivastava LKO 22-Nov-11 4:45am    
Thank u Sir
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900