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-\u06FF]/
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-\u06FF]/
Probably you'd have to check what range the numbers match and exclude it (formally not include in brackets expression).
Here I've found another helpful source.
I'd suggest this for only letters
as this matches arabic digits only
Edit:
I've found that there are two ranges for arabic and arabic-indic digits in unicode.
If you need a regex to match a line just then, when it contains arabic letters and numbers - use this:
If you want to also discourage arabic digits - use this:
If you want to match a substring, not only a whole line, use this:
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:
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.
I tried all solutions provided here, nothing worked, finally one solution worked for me for Arabic letters only