Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8058249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:17:38+00:00 2026-06-05T09:17:38+00:00

After reviewing Time validation question by Amra I have created a regexp for my

  • 0

After reviewing Time validation question by Amra

I have created a regexp for my needs

var re = /^\s*([01]?\d|1[0-2]):?([00,30]\d)\s*$/;

my intention is to allow only the hour and half an hour interval times

ie: “12:00″,”01:00″,”12:30″,”01:30”, etc

This regexp almost works, it returns false when “01:10” but it returns the value when i enter “01:01″….”01.09”, it has to be false.

Please help me

And please describe this regexp in detail..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:17:40+00:00Added an answer on June 5, 2026 at 9:17 am

    [00,30] does not do what you think it does. [] groups in a regexp are character classes – sets of characters that can be matched, for instance [a-z] matches a single lowercase letter, not the string “a-z”.

    Try this instead:

    var re = /^\s*(0?\d|1[0-2]):?(00|30)\s*$/;
    

    (00|30) matches either 00 or 30 and nothing else – | is the regex “or” operator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem recieving notifications from LocationManager after a set period of time:
I am having some issues with logging. After reviewing JBoss Seam source code, I
After using Instruments, I have found the a spot in my code that is
After reading many times this question and its accepted answer How to execute a
After searching for a long time for a simple way of changing the text
in my system i should send notification mail after reviewing a list i am
OK, after reviewing some code with PMD and FindBugs code analyzers, i was able
I'm new to RequestFactory but with generous help of Thomas Broyer and after reviewing
folks. I'm starting with CakePHP and after reviewing this tutorial ( http://book.cakephp.org/view/1543/Simple-Acl-controlled-Application ) and
After reviewing this answer and given the extension method: public static bool IsIn<T>(this T

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.