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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:00:03+00:00 2026-05-27T13:00:03+00:00

Hei ! can regex support 2011999 So we force the first 4 digits to

  • 0

Hei !
can regex support 2011999
So we “force” the first 4 digits to be 2011 or 2012 ,2013 etc, and as a set of numbers behind it? Which means that it will be 2011 + 3 digits
the first digit must always be 2011 or 2012 etc?

How can I get this using regular expression?

  • 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-27T13:00:04+00:00Added an answer on May 27, 2026 at 1:00 pm

    It depends on the values you want. It’s often better with these sort of questions to specify the rules rather than examples, since there may be many different ways to interpret the examples.

    As a start, if you want the first four digits to be 201x where x is 1 thru 9 inclusive, followed by three digits, you could use something like:

    ^201[1-9][0-9]{3}$
    

    (depending on the modern-ness of your regex engine.

    Or, if you’re processing things like YYYYDDD where DDD is the zero-based day of the year and you don’t want any dates before 2011, you may end up with a monstrosity like:

    ^((201[1-9])|(20[2-9][0-9])|(2[1-9][0-9][0-9]))
        (([0-2][0-9][0-9])|(3[0-5][0-9])|(36[0-5]))$
    

    (though only up to the year 2999 and allowing 366 days even in non-leap years) at which point you may want to consider just using (more readable) code rather than a regex 🙂

    That’s the sort of range of possibilities you’re looking at with a question along the lines of “must always be 2011 or 2012 etc” though, if you can lock down the specifications a little more, we can hopefully remove the more bizarre possibilities.

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

Sidebar

Related Questions

Hei I’m trying to learn Linq to SQL and wondering if somebody can suggest
Hei guys, I have the following problem: As I can see those arrows are
Hei! How can I create an aggregate function to obtain a list of the
Well, I have this program, the download option is working fine. I can access
hei, Using Linq to SQL (ala NorthWind database for example): How to select all
Hei , Following is my html code and css . I dont want to
I have two arrays, each containing strings. The first array is a list of
Hei Have anyone idea of input mask in jquery For example a field must
First of all I'd like to precise that I've read all the jQuery called
Hei, i think order by is ordering things wrongly. Example code: static void Main()

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.