This rerolls and shows all rolls. You can adjust the output to suit your needs.

Code:
on *:text:roll &:#: {
  if ($2 !isnum) { msg $chan Invalid number of dice. | return }
  var %c = $2, %tens = 0
  while (%c) {
    var %roll = $rand(1,10)
    if (%roll = 1) { var %roll = 04,01 $+ %roll }
    elseif (%roll isnum 2-7) { var %roll = 00,01 $+ %roll }
    elseif (%roll isnum 8-9) { var %roll = 03,01 $+ %roll }
    else { var %roll = 09,01 $+ %roll | inc %c | inc %tens }
    var %dice = %dice $+ $iif(%dice, $+ $chr(44)) %roll
    dec %c
  }
  describe $chan $nick rolls $2 dice (with %tens re-roll $+ $iif(%tens != 1,s) $+ ): $replace(%dice,$chr(46), $+ $chr(44) $+ $chr(32))
}


Notice that the only change it to increment the counter when a 10 is rolled so that it rolls an extra time and also increment a variable to count the number of tens rolled. The only other change is the output shows the number of re-rolls. The $iif() in that just changes whether re-rolls is plural or not based on the number of tens.