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 253691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:46:59+00:00 2026-05-11T21:46:59+00:00

We are using a RegEx Validator to validate an input from a textbox. The

  • 0

We are using a RegEx Validator to validate an input from a textbox.

The current RegEx expression checks if the current number is between the range of 1 – 999.

We just inherited this code and we need to change the range from 999 to just 365. In short, we need to write a regex to check if the input is between 1 – 365.

Of course, we can just use a RangeValidator or a custom validator. But we don’t want to do that because we don’t want to introduce a “significant” change.

Thanks!

EDIT:

We should also catch this following patterns:
001 for 1
019 for 19

  • 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-05-11T21:46:59+00:00Added an answer on May 11, 2026 at 9:46 pm

    Using regular expressions is certainly not the best way to validate integer ranges, but here you go:

     ^([1-9][0-9]?|[12][0-9][0-9]|3[0-5][0-9]|36[0-5])$
    
    [1-9][0-9]?     matches    1 -  99
    [12][0-9][0-9]  matches  100 - 299
    3[0-5][0-9]     matches  300 - 359
    36[0-5]         matches  360 - 365
    

    EDIT: With leading zeros (also matches strings like 00000000321):

     ^0*([1-9][0-9]?|[12][0-9][0-9]|3[0-5][0-9]|36[0-5])$
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 227k
  • Answers 227k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I generally find factories to be a good thing to… May 13, 2026 at 1:28 am
  • Editorial Team
    Editorial Team added an answer The Twitter API will help you for Twitter, since it's… May 13, 2026 at 1:28 am
  • Editorial Team
    Editorial Team added an answer There's a discussion on Microsoft Connect about this (What is… May 13, 2026 at 1:28 am

Related Questions

I am attempting to fix some bilingual xml files using regular expressions to match
Ok, I have a major issue with a control I am using. The site
Is it possible to use a RegEx to validate, or sanitize Base64 data? That's
I need to scramble the names and logins of all the users in a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.