I'm trying to improve my understanding on RegEx. I have the following RegEx in php
preg_replace("/(\d)(?=(\d{3})+$)/", '$1,', "35000");
What this does is add commas into the number (35,000). What i would like to understand is how does this work?
From what i know so far, it seems that it starts from a single digit and looks ahead for occurrence of 3 digits. But i don't think my understanding is correct.
Thanks in advance.
EDIT
I noticed that the following also works:
preg_replace("/(?=(\d{3})+$)/", ',', "35000");