I have the a vehicle registration number being validated by Joi in Node.js and need it to reject any string that contains whitespace (space, tab, etc.)
I tried the following schema, but Joi does let it go through:
const schema = {
regNo: Joi.string()
.regex(/^.*\S*.*$/)
.required()
.trim()
}
So, if I submit "JOI 777" the string is considered valid.
What am I doing wrong? Thanks in advance,