The ability to evaluate identifiers after substitutions in $regsub is a good idea, but has also been requested several times before. One workaround that can be used is having the identifiers escaped in the subtext and evaluating your result variable twice:
alias rp_mod {
var %x = $1, %y = $regsub($1, /\|([^|]*)\|/g,$cr \$+ \$abs(\$calc(\1)) \$+ $cr, %x))
return $remove($(%x,2),$cr)
}
Of course if you don't expect there to be any calculations in the modulus function then you could just adapt your original alias slightly:
alias rp_mod {
var %x = $1, %y = $regsub($1, /\|-?(.+?)\|/g, \1, %x))
return %x
}
So it removes the hyphen without substituting it back in. But I assume you expect there to be calculations such as |2-3| present in which case the first alias would be the better option
With the double evaluation of %x there's always the problem that you might be evaluating other parts of a string you don't want to be, or removing $cr in places you don't want to so in this case I'd use a loop with $regex:
alias rp_mod {
var %x = $1
while ($regex(%x,(\|(.+?)\|))) %x = $replace(%x,$regml(1),$abs($calc($regml(2))))
return %x
}
Those are just some workarounds to keep in mind until the feature you suggested may be added. As for the factorial identifier, you're right in saying it can be scripted but it would become inaccurate before slow since by the time 1000! is hit, it would require 1000 iterations each involving a simple mathematical operation which can be handled quite quickly, but due to the limitation of mIRC's calc functions it would be inaccurate