Click here to Skip to main content
15,177,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a textbox field in an ASP app in which user will enter will be the UTC offset like +13:45.

I want to check this entered value using a regex

Any suggestions

What I have tried:

I am currently using this regex
Updated 20-Jun-18 1:43am
George Swan 19-Jun-18 16:20pm
Do you need to use Regex? Why not do if(n % 5==0){..}

If you are going to work with Regular Expressions, get a copy of Expresso[^] - it's free, and it examines and generates Regular expressions.
Christopher Fernandes 20-Jun-18 6:31am
Thanks a lot sir
OriginalGriff 20-Jun-18 6:38am
You're welcome!
Your RegEx is really weird, if you use debuggex (last link), you will see a very nice graph which will help understand what does the regEx.
You should explain what you want and give examples of what must match and what must not.
As I see hours from 00 to 04 and from 10 to 14 are allowed but not from 05 to 09.

Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre -[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
RegExr: Learn, Build, & Test RegEx[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
This worked for me

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