i'm never going to understand regex :(, hopefully there are some tutorials on mirc.net or other sites I can download, thanks Mpdreamz. 
Don't worry, I haven't figured it out yet, either.  

Here's a non-regex version that should also work.
on *:dialog:name:edit:ID: {
  if ($did($did) !isnum) { did -r $dname $did }
}
Note that if you use * instead of an ID in that on DIALOG line, you'll need to put the ID number in place of the second and third $did's instead of using $did...
on *:dialog:name:edit:2: {
  if ($did(2) !isnum) { did -r $dname 2 }
}
As a last note, I am pretty sure you don't need $dname in the $did(2) / $did($did) part in the IF statements because the on DIALOG names the dialog (it isn't a *).  If it doesn't work, then use $did($dname,2) or $did($dname,$did).