Gonzalo Pincheira Arancibia Gonzalo Pincheira Arancibia - 6 months ago 23
Javascript Question

Javascript improve regex to match number chunks of 3

I want to get a number chunks of 3 if i could by example if i have the number

i want to get
. Using the following regex


I get

Anyone can help me to improve my regex?

An example in here --> https://regex101.com/r/cF6rN4/1
and a snippet in this post



Match strings which are followed by digits of length as 3's multiplier or at the end.


Regex explanation here.

Regular expression visualization

You can avoid the capturing group since it's not necessary.