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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:51:49+00:00 2026-05-11T11:51:49+00:00

I would like to match with RegExp a number between X and Y. Is

  • 0

I would like to match with RegExp a number between X and Y. Is that possible?

([0-9]+) will match any number, how could I do to match a number between, for instance, 110 and 2234?

  • 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. 2026-05-11T11:51:50+00:00Added an answer on May 11, 2026 at 11:51 am

    According to Generate a Regular Expression to Match an Arbitrary Numeric Range, and after generating such a regex for your example at Regex_For_Range:

    \b0*(1[1-9][0-9]|[2-9][0-9]{2}|1[0-9]{3}|2[01][0-9]{2}|22[0-2][0-9]|223[0-4])\b 

    would do the trick.

    The process would be (still following that Regex generator):

    First, break into equal length ranges:

    110 - 999 1000 - 2234 

    Second, break into ranges that yield simple regexes:

    110 - 199 200 - 999 1000 - 1999 2000 - 2199 2200 - 2229 2230 - 2234 

    Turn each range into a regex:

    1[1-9][0-9] [2-9][0-9]{2} 1[0-9]{3} 2[01][0-9]{2} 22[0-2][0-9] 223[0-4] 

    Collapse adjacent powers of 10: 1[1-9][0-9] [2-9][0-9]{2} 1[0-9]{3} 2[01][0-9]{2} 22[0-2][0-9] 223[0-4]

    Combining the regexes above yields:

    0*(1[1-9][0-9]|[2-9][0-9]{2}|1[0-9]{3}|2[01][0-9]{2}|22[0-2][0-9]|223[0-4]) 

    Next we’ll try factoring out common prefixes using a tree:
    Parse into tree based on regex prefixes:

    . 1 [1-9] [0-9] + [0-9]{3} + [2-9] [0-9]{2} + 2 [01] [0-9]{2} + 2 [0-2] [0-9] + 3 [0-4] 

    Turning the parse tree into a regex yields:

    0*(1([1-9][0-9]|[0-9]{3})|[2-9][0-9]{2}|2([01][0-9]{2}|2([0-2][0-9]|3[0-4]))) 

    We choose the shorter one as our result.

    \b0*(1[1-9][0-9]|[2-9][0-9]{2}|1[0-9]{3}|2[01][0-9]{2}|22[0-2][0-9]|223[0-4])\b 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know how can I create a regexp to match the
I would like to match url pattern that has optional segments. I have URL-s
I want to create a regex that will match any of these values 7-5
I would like to regex match a sequence of bytes when the string '02
I would like to match a pattern in which two words must be present,
I would like to match the numbers inside an HTML tag such as: Sometext<sometag><htmltag>123123</htmltag></sometag>
I would like to match positive and negative numbers (no decimal or thousand separators)
I have a route like following, ideally I would like it to match: domain.com/layout/1-slug-is-the-name-of-the-page
I would like 'about' to route to 'abouts/1' I tried this: match 'about' =>
I would like to build an excel VBA program to find all the match

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.