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

The Archive Base Latest Questions

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

preg_match_all(‘/(\d{4})/’, $text, $matches); Using above function we can extract exact 4 digit numbers from

  • 0
preg_match_all('/(\d{4})/', $text, $matches);

Using above function we can extract exact 4 digit numbers from a given string.

How can extract the numbers that contains greater than 4 digits using regular expression..

Is there any way to specify the minimum length in regular expressions ?

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

    Yes, you can specify the minimum length:

    /(\d{4,})/
    

    The brace syntax accepts a single number (as you used) indicating the exact number of repetitions to match, but it also allows specifying the minimum and maximum number of repetitions to match, separated by a comma. If the maximum is omitted (but the comma isn’t), as in this answer, then the maximum is unbounded. The minimum can also be omitted, which is the same as explicitly specifying a minimum of 0.

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

Sidebar

Related Questions

How can i get the numbers 148.42 from the markup below with preg_match_all? They
I am using preg_match_all to pull phone numbers from a thread. This puts them
I have the following regex that I have been using successfully: preg_match_all('/(\d+)\n(\w.*)\n(\d{3}\.\d{3}\.\d{2})\n(\d.*)\n(\d.*)/', $text, $matches)
preg_match() gives one match. preg_match_all() returns all matches. preg_split() returns all splits. How can
i'm using preg_match_all('/<?(.*)?>/', $bigString, $matches, PREG_OFFSET_CAPTURE); to find the contents of everything between <?
function strip_cdata($string) { preg_match_all('/<!\[cdata\[(.*?)\]\]>/is', $string, $matches); return str_replace($matches[0], $matches[1], $string); } I use the
A followup question to Get all text between tags with preg_match_all() or better function?
My Code preg_match_all('/\{([\w]+)(\s.*)?[^\}]\}(.*)\{\/\w+[^\}]\}/', $nbody, $matches ); My Template rtrim: Beginning Text{rtrim} String {/rtrim}Surrounding Text
I need to print all matches using preg_match_all. $search = preg_match_all($pattern, $string, $matches); foreach
Im trying to convert this php function to javascript: function sanitize_words($string,$limit=false) { preg_match_all(/\p{L}[\p{L}\p{Mn}\p{Pd}'\x{2019}]{1,}/u,$string,$matches,PREG_PATTERN_ORDER); return

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.