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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:48:03+00:00 2026-05-26T02:48:03+00:00

I have a problem building a regex. this is a sample of the text:

  • 0

I have a problem building a regex. this is a sample of the text:

text 123 12345 abc 12    def 67 i 89 o 0    t 2

The numbers are sometimes padded with blanks to the max length (3).
e.g.:

  • “1” can be “1” or “1 “
  • “13” can be “13” or “13 “

My regex is at the moment this:

\b([\d](\s*)){1,3}\b

The results of this regex are the following: (. = blank for better visibility)

123.
12....
67.
89.
0....
2

But I need this: (. = blank for better visibility)

123
12.
67.
89.
0..
2

How can I tell the regex engine to count the blanks into the {1,3} option?

  • 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-26T02:48:03+00:00Added an answer on May 26, 2026 at 2:48 am

    Try this:

    \b(?:\d[\d\s]{0,2})(?:(?<=\s)|\b)
    

    This will also cover strings like text 123 1 23 12345 123abc 12 def 67 i 89 o 0 t 2 and results in:

    123
    1.
    23.
    12.
    67.
    89.
    0..
    2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with building a dll with gcc (mingw). From this site
Building on this question , now I have another problem. Given this, shipments =
I have an old C++ project and I'm having problem building it. For a
I am building my first ASP.Net MVC based app and have a problem accessing
I'm building a micro site at the moment and I have a problem. I
I have searched/Googled around but I'm struggling with the following problem. I am building
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have a problem building applicatin with tabBarController. There is no problem doing tabBarController
I have a problem with g++ building an application which links to a static
I have a weird problem while building VS2010 solution incl. unit tests on a

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.