Validate field for all language characters through REGEX

后端 未结 3 714
离开以前
离开以前 2021-02-10 01:05

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:39

    You can test for a unicode letter like this:

    str.match(/\p{L}/u)
    

    Or for the existence of a non-letter like this:

    str.match(/[^\p{L}]/u)
    

提交回复
热议问题