Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular Expression Arabic characters and numbers only

I want Regular Expression to accept only Arabic characters, Spaces and Numbers.

Numbers are not required to be in Arabic.

I found the following expression:

^[\u0621-\u064A]+$ 

which accepts only only Arabic characters while I need Arabic characters, Spaces and Numbers.

like image 969
moujtahed Avatar asked Apr 19 '15 11:04

moujtahed


1 Answers

Just add 1-9 (in Unicode format) to your character-class:

^[\u0621-\u064A0-9 ]+$ 

OR add \u0660-\u0669 to the character-class which is the range of Arabic numbers :

^[\u0621-\u064A\u0660-\u0669 ]+$ 
like image 182
Mazdak Avatar answered Sep 23 '22 11:09

Mazdak