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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:38:49+00:00 2026-06-13T02:38:49+00:00

I need a Regex for numbers that considers thousands and decimal places. The one

  • 0

I need a Regex for numbers that considers thousands and decimal places. The one I came up so far is:

\d{1,3}(\.\d{3})*(,\d*)?

It will catch 3.000,00 as well as 3,00 and 3.000. Sweet.

The problem is that I need it to be very greedy, and capture larger numbers first, for instance, for this input:

125,45.124.890,45,32,67.456

I’d need it to capture 45.124.890,45 as a number. It’s important to me because it’s the biggest one. My regex just won’t work, because it will capture 123,45 and then 45 will not be considered for the next match. So the next number it captures is 124.890,45 which is not good for me.

Any thoughts?

PS As I’m brazillian the separators are inverted

  • 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-13T02:38:51+00:00Added an answer on June 13, 2026 at 2:38 am

    Use regex pattern

    (?!0\d)\d{1,3}(?:\.\d{3})*(?:\,\d+(?![\d\.]))?
    

    C# demo:

    using System;
    using System.Text.RegularExpressions;
    
    public class Test
    {
      public static void Main()
      {
        const string line = @"125,45.124.890,45,32,67.456";
        MatchCollection matches = Regex.Matches(line, 
          @"(?!0\d)\d{1,3}(?:\.\d{3})*(?:\,\d+(?![\d\.]))?");
        foreach(Match match in matches)
        {
          foreach (Capture capture in match.Captures)
          {
            Console.WriteLine(capture.Value);
          }
        }
      }
    }
    

    Output:

    125
    45.124.890,45
    32
    67.456
    

    Test this demo here.

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

Sidebar

Related Questions

I need some regex that will match only numbers that are decimal to two
I need a regex that allows numbers and optional commas, but the entire length
I have this regex working but now need to allow numbers without the decimal
Input: hello world 22 bye world I need a regex that will work in
Need a regex that will match either of {m,n}|{m,}|{,n}|{n} (where m and n are
I need a regex that can match a string of numbers from 1 to
I need a regex for four-digit numbers separated by comma (default can also be
I need a RegEx that can handle an integer between 1 - 999 or
I need a regex that also matches Chinese, Greek, Russian, ... letters. What I
I need to match phone numbers that : start with 010 or 012 or

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.