Found (\d)(?=(\d{3})+$) is an interesting regex, here is what it can do:
From w3schools,
- \d Find a digit
- n{X} Matches any string that contains a sequence of X n's
- ?=n Matches any string that is followed by a specific string n
So (\d)(?=(\d{3})+$) breaks down to:
- \d{3} Three digits
- (\d{3})+ One or more group of three digits
- (\d{3})+$ One or more group of three digits from the end of input.
- (\d)(?=(\d{3})+$) A digit that has has the follow string which is one or more group of three digits from the end of input.
I've no idea what the performance look like for this regex, but it's quite powerful and interesting!