When we have troublesome inputs, we tend to put instructions near them describing the requirements, and then just let validation handle the valid/invalid states.
Sometimes we have multiple validators, to check that a field has content at all, that it isn't too long, and that it meets the required formatting checks.
But trying to encode instructions inside the validators for all the things they check for seems like the effort:reward ratio is out of whack. It also seems like it would make a nasty little maintenance headache, too, as requirements change or users find new ways to generate errors.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
When we have troublesome inputs, we tend to put instructions near them describing the requirements, and then just let validation handle the valid/invalid states.
Sometimes we have multiple validators, to check that a field has content at all, that it isn't too long, and that it meets the required formatting checks.
But trying to encode instructions inside the validators for all the things they check for seems like the effort:reward ratio is out of whack. It also seems like it would make a nasty little maintenance headache, too, as requirements change or users find new ways to generate errors.