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

  • Home
  • SEARCH
  • 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 9064853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:21:36+00:00 2026-06-16T16:21:36+00:00

I have made this regex ^(00|0[0-9]|1[012]):[0-5][0-9]? ((a|p)m|(A|P)M)$ but the problem is it is accepting

  • 0

I have made this regex

 ^(00|0[0-9]|1[012]):[0-5][0-9]? ((a|p)m|(A|P)M)$

but the problem is it is accepting
00:00 am which i dont want to be like this
how to ignore?
I want time to be in this format
12:12 am
it should not be in this
00:21 am
I am using this code for validation

        private bool valtime()
    {
        Regex regex = new Regex("^(00|0[0-9]|1[012]):[0-5][0-9]? ((a|p)m|(A|P)M)$");
        if (regex.IsMatch(textBox1.Text))
        {
            return false;
        }
        else
        {
            return true;
        }
    }
  • 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-16T16:21:37+00:00Added an answer on June 16, 2026 at 4:21 pm

    You could use:

    Regex.IsMatch(input, @"^(0[1-9]|1[0-2]):[0-5][0-9] [ap]m$", RegexOptions.IgnoreCase);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an input like this test1.test2.part01 which I want to strip away to
I have this problem which made my scratch my head: Is there a way
I have made this regular expression which does exactly what I want when I
I have made this regex: (?<=span class=ope>)?[a-z0-9]+?\.(pl|com|net\.pl|tk|org|org\.pl|eu)|$(?=<\/span>)$ It does match the strings like: example.pl
Hi have made this function which is made to replicate an error that I
OK, I was just fooling around in my spare time and have made this
Ok so i've made this function which works fine for converting most urls like
I have a simple problem: I want to construct a regex that matches a
I feel kind of stupid asking this but I have made a few regular
I have a little problem with regex in iOS. I want to delete each

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.