Regular expressions validate more than two Chinese characters

how to limit regular expressions with more than two Chinese characters

Mar.26,2021

/ ^ [u4e00-u9fa5] {2,} $/

clipboard.png


[u4e00-u9fa5] is to match two or more unicode-encoded characters. If you want to match more than two characters, then you directly / ^ [u4e00-u9fa5] {2,} $/, with ^ means only match the beginning of Chinese characters, not numbers, letters and other

.
Menu