This will only work with positive whole numbers of virtually any size, up to whatever is supported in a Calc / Formula, some monstrous 64bit integer or something. Be sure to Round / Ceil / Floor / Trunc any numbers that might contain decimal places.

Code: Select all

```
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[MeasureNumber]
Measure=Calc
Formula=Round(83902137402495.51)
RegExpSubstitute=1
Substitute="^(\d{1,2}?)((\d{3})+)$":"\1,\2","(\d{3})(?=\d)":"\1,"
[MeterString]
Meter=String
FontSize=13
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=[MeasureNumber:]#CRLF#[MeasureNumber]
DynamicVariables=1
```

Looks ahead optionally for either 1 or 2 numbers, followed by a repeating pattern of 3 numbers and the end of the string. That will get the beginning part of the string, assuming that it is a number like 9,000 or 99,000. It adds a comma after that pattern. If there are no patterns of 3 numbers after the first capture group, the number is less than 1,000 and nothing is done. So at the end of the first part of the substitution in our example, we end up with:

83,902137402495

Then it takes that result, and looks ahead to add commas after every repeating pattern of 3 numbers excepting the one that ends the string (it knows that by looking ahead after capturing each group of three to see if there are any more numbers to come (?=\d)):

83,902,137,402,495