Validation inside controller

Place validates_format_of inside your account model and have your controller pass your validation string to it.