.isAlpha() method description from validator.js documentation (express-validator is also a wrapper for validation functions of this module):
check if the string contains only letters (a-zA-Z)
Your string John Doe contains a whitespace, that’s why validation is not succesfull.
Your validation chain can be this one:
req.check('name')
.isLength({min:3}).withMessage('Name must be of 3 characters long.')
.matches(/^[A-Za-z\s]+$/).withMessage('Name must be alphabetic.')
.isAlpha() is replaced with matches(). Validation is successful when name is a string with 3 characters and more (alphabetic characters or whitespaces only).
Source: validator.js validators
Reference Link – https://stackoverflow.com/questions/58475407/how-to-check-if-input-in-input-field-has-alphabets-only-in-express-validator






![Cannot read property ‘toLowerCase’ of undefined [ERROR] An error occurred while running subprocess cordova.](https://blog.rahulbhutani.com/wp-content/uploads/2020/12/ionic-enable-xcode-permissions-banner-100x70.png)









