Skip to content
Advertisement

Laravel validate regex not allow kanji char

I want to validate a form input which not allow input kanji char using Laravel validate rule. How to do it? This is what I did:

JavaScript

But this work only when all char are kanji. If one of char is not kanji then the regex return valid.

actually now:

ひらがなカタカナ漢字 => valid

123abc => valid

ひらがなカタカナ => valid

漢字 => not valid

what I want:

ひらがなカタカナ漢字 => not valid

123abc => valid

ひらがなカタカナ => valid

漢字 => not valid

Advertisement

Answer

This is final script resolve this case:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement