The validation code is here https://github.com/NodeBB/NodeBB/blob/master/public/src/client/register.js. You can write a plugin to validate your own inputs.
Benchpress had no built-in way to do this. You'll need to add a helper in order to do subtraction.
https://community.nodebb.org/topic/11801/help-with-using-helpers-inside-my-theme