Regular Expression not to allow numbers - just Arabic letters

前端 未结 4 1608
猫巷女王i
猫巷女王i 2021-01-30 18:43

I found this regular expression for Arabic letters but it is also allowing numbers with letters. How can I change it to let it allow letters only ?

/[\\u0600-\\u         


        
4条回答
  •  遇见更好的自我
    2021-01-30 19:19

    First, concerning Arabic encoding in unicode, you might want to refer to this tables here

    As for the regex you were given, [\u0600-\u06FF] is the range of all arabic characters on the unicode listing, definitely that includes even letters, control characters, white-space, and numbers.

    My recommendation would be:

    /[\u0600-\u06FF&&[^\U06F0-\06F9]]/
    

    Which spans just everything minus the arabic numeric digits (0-9).

    That subtracts a range from the 'super' range. Am just not sure whether your target regex dialect supports this.

提交回复
热议问题