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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:05:47+00:00 2026-06-08T13:05:47+00:00

I have also seen it as +$. I am using $(this).text( $(this).text().replace(/(\d)(?=(\d{3})+(?!\d))/g, $1,) );

  • 0

I have also seen it as +$.

I am using

$(this).text( $(this).text().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,") );

To convert 10000 into 10,000 etc.

I think I understand everything else:

  • (\d) – find number
  • (?=\d{3}) – if followed by 3 numbers
  • ‘+’ – don’t stop after first find
  • (?!\d) – starting from the last number?
  • /g – for the whole string
  • ,”$1,” – replace number with self and comma
  • 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-08T13:05:49+00:00Added an answer on June 8, 2026 at 1:05 pm

    I think you’re slightly misreading it:

    • (?=\d{3}) – if followed by 3 numbers

    Note that the regexp is actually:

    (?=(\d{3})+
    

    i.e. you’ve missed an open paren. The entire of the following:

    (\d{3})+(?!\d)
    

    is within the (?= ... ), which is a zero-width lookahead assertion—a nice way of saying that the stuff within should follow what we’ve matched so far, but we don’t actually consume it.

    The (?!\d) says that a \d (i.e. number) should not follow, so in total:

    • (\d) find and capture a number.
    • (?=(\d{3})+(?!\d)) assert that one or more groups of three digits should follow, but they should not have yet another digit following them all.

    We replace with "$1,", i.e. the first number captured and a comma.

    As a result, we place commas after digits which have multiples of three digits following, which is a nice way to say we add commas as thousand separators!

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

Sidebar

Related Questions

I am a Java programming now also writing in C#. I have seen Accessor
I have also tried .('refresh') and .page() to no avail. The text-box updates but
Im using restkit and push notifications and I have also built the interface, so
I've seen this format function referenced on several sites, but none of them have
Ok this is the weirdest thing I have seen in a while... I am
I have been trying to parse for this certain piece of text in a
I have actually seen this question quite a bit here, but none of them
I have seen a mention of using JQuery tmpl in a faster way to
Using jQuery 1.7.1, I have noticed that the value attribute/property of a text input
I have a website that has one database I have also Desktop apps that

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.