Regex to match Hebrew and English characters except numbers

后端 未结 3 638
庸人自扰
庸人自扰 2020-12-16 21:31

I have a question: I want to do a validation for the first and the last name with RegEx. I want to do it with only Hebrew and English without numbers. Someone can help me to

相关标签:
3条回答
  • 2020-12-16 21:54

    While the selected answer is correct about "Hebrew" the OP wanted to limit validation to only Hebrew and English letters. The Hebrew Unicode adds a lot of punctuation and symbols (as you can see in the table here) irrelevant for such validation. If you want only Hebrew letters (along with English letters) the regex would be:

    /^[a-z\u05D0-\u05EA]+$/i
    

    I would consider adding ' (single quote) as well, for foreign consonants that are missing in Hebrew (such as G in George and Ch in Charlie) make use of it along with a letter:

    /^[a-z\u05D0-\u05EA']+$/i
    
    0 讨论(0)
  • 2020-12-16 22:07

    Seemingly Hebrew has the range \u0590-\u05fe (according to this nice JavaScript Unicode Regex generator`.

    /^[a-z\u0590-\u05fe]+$/i
    
    0 讨论(0)
  • 2020-12-16 22:19

    Try this. Not sure if it will work. If not, these references should help.

    [A-Za-z\u0590-\u05FF]*
    

    Hebrew Unicode

    Unicode in Regular Expressions

    0 讨论(0)
提交回复
热议问题