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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:28:17+00:00 2026-06-06T10:28:17+00:00

I need to extract numbers that are longer than 3 digits and do not

  • 0

I need to extract numbers that are longer than 3 digits and do not include years within a given range (e.g. between 19xx and 2020, where XX is always in the end of the string).

I am currently using the following pattern:

/(?!19[0-9]{2}|200[0-9]|201[0-9]|202[0-9])\d{3,}$/i

When I test the expression with “something 2012”, I always get the result 012. I need to get null.

var s = "moose high performance drive belt 2012";
s.match(/(?!19[0-9]{2}|200[0-9]|201[0-9]|202[0-9])\d{3,}$/i);

Why does this expression incorrectly match the end of a date?

  • 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-06T10:28:18+00:00Added an answer on June 6, 2026 at 10:28 am

    It discards something , then attempts to match 2012 but fails due to your negative look-ahead assertion, then attempts to match 012, which succeeds because indeed, 012 does not match your negative lookahead assertion.

    UPDATE:

    This isn’t pretty but it’s one solution. Perhaps you can simplify it.

        (?!(?:19[0-9]{2}|200[0-9]|201[0-9]|202[0-9])\D)(?<!\d)\d{3,}
    

    See a demo here: http://rubular.com/r/FLiehrUEp8.

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

Sidebar

Related Questions

Trying to create a simple regular expression that can extract numbers(between 7 - 14)
I'd like to extract some digits that are not followed by star, here is
I have HTML that I need to extract a part number from, the HTML
I need to extract data from a source that presents it in one of
I need a SUM from an column of cells that contains text and numbers.The
So I have a URL that I need my Flash movie to extract variables
I need to extract a number of unique elements from a collection given a
I want to extract some phone numbers that are in a local text file
I need to extract the ID number from a string. The results are given
I have a Delphi DLL that I did not write, but need to call

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.