Latin Characters check

前端 未结 3 2013
执念已碎
执念已碎 2021-01-05 09:16

there are some similar questions out there, but none that are quite the same or that have an answer that works for me.

I need a javascript function which validates w

3条回答
  •  有刺的猬
    2021-01-05 09:49

    One possible way of how it can be done:

    if (/[^\u0020-\u007F\u00A0-\u024F\u1E00-\u1EFF]/.test(value)) {
        // non latin characters found
    }
    

    The regular expression tests for characters that are not ^ in the set [] of \u0020-\u007F, \u00A0-\u024F, and \u1E00-\u1EFF groups.

提交回复
热议问题