In reply to Richard White:
Place the different parts of the regex in parentheses to group them, then use $1 for the first match, $2 for the second, etc.
So your replacement is /([0-9]{4})-([0-9]{2})-([0-9]{2})/"$1"-"$2"-"$3"/g
Slightly easier to read is:
/(d+)-(d+)-(d+)/"$1"-"$2"-"$3"/g
Though that doesn't limit the number of digits in each group so you could have 12334567-9-21 as a valid input.
Post edited at 12:46