It can be done with regex, but it can also be done without.

Using your examples:

Code:
On @*:Join:#: {
  var %n = $nick
  $iif(*_* iswm %n, $iif(($gettok(%n,2,95) isnum) && ($len($gettok(%n,2,95)) == 7),ban -k $chan %n 2))
}