Yup validation with regex using matches problem

Your regex should cover your whole string, by using ^ and $ to signify start and end of string:

/^[abcdefghijklmnopqrstuvwxyz]+$/

Otherwise, it will match part of your string, which is why it matches when you have a mix of good and bad characters, but fails when every character is bad.

You can shorten the regex by using a character range like this:

/^[a-z]+$/

You can use this online tool to build and test your regex.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)