选项允许用户名不必以字母数字字符开始或结束

I’ve once spoken with someone about ruby. Is this doable with a plugin? I heard him mention I can override functions, such as in this case the validator. Is this correct?