Although Riamus2 showed you above how $iif works. I'll break down the 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))
}
You have your simple on join event, obviously only triggers if you're an operator.
I'm using %n to store the nickname just so we don't keep repeating ourselves with $nick in the if statement.
if (*_* iswm %n)
We check to see if there's anything before and after the underscore.
$iif(($gettok(%n,2,95) isnum) && ($len($gettok(%n,2,95)) == 7),ban -k $chan %n 2)
This only triggers if our if statement is true. As it's true, we then want to compare that anything after the underscore has a numeric value and that the length of the numbers is 7. M_
2728816 has 7 numbers after the underscore. If all that is again true, we issue the ban command.
You can add a kick message after the number two:
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 <Kick Message Here>))
}
with that said, Riamus2 come up with a regex solution in one of your previous posts.