Validate field for all language characters through REGEX

后端 未结 3 1609
隐瞒了意图╮
隐瞒了意图╮ 2021-02-10 01:10

i need to validate a field for empty. But it should allow English and the Foreign languages characters(UTF-8) but not the special characters. I\'m not good at R

3条回答
  •  遥遥无期
    2021-02-10 01:30

    It would have been nice if I could say "Just do /^\w+$/.test(word)", but...

    See this answer for the current state of unicode support (or rather lack of) in JavaScript regular expressions.

    You can either use the library he suggests, which might be slow or enlist the help of the server for this (which might be slower).

提交回复
热议问题