I don't know anything about $regex() but I think this will do what you want, if not there's a few on here that know $regex(). smile

Code:
on @*:JOIN:#: {
  if ($regex($fulladdress, /~[a-z](?:\d{2,})@/i) || $regex($fulladdress, /[a-z](?:\d{2,})@/i)) {
    ban -k # $nick 2 Auto-ban: Spam bot. 
  }
}