I was tring to validate string to contain only digits from 0 to 9 using regex but it doesn't work with me as expected.
joi.string().trim().regex(/[0-9]/).max(15)
You have to anchor your regex like ^[0-9]+$.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Most helpful comment
You have to anchor your regex like
^[0-9]+$.