I have this form that has a validation JQuery function, I have a problem with the telephone field, all I want is for the users to enter numbers only ... Its working great on the English form, but on the Arabic form, if I enter the numbers using the Arabic language the form won't submit. Anyone knows what is the regular expression for the Arabic numbers ??
Asked
Active
Viewed 1.3k times
15
-
3I always thought the numbers we are using in in the western culture ARE Arabic ... – Hinek Nov 09 '10 at 13:22
-
2@Hinek there are east arabic numerals which are different. I learned that in another question here on SO... – Pekka Nov 09 '10 at 13:22
-
Can you give examples of valid and invalid numbers with reasoning? – Brad Nov 09 '10 at 13:25
-
Arabic numbers are exactly equivalent to ordinary numerals, except for the different charset (but it is a bit hard to distinguish 0 from a dot). – Ofir Nov 09 '10 at 13:29
-
1@Hinek background info http://en.wikipedia.org/wiki/Eastern_Arabic_numerals – Pekka Nov 09 '10 at 13:39
-
In the link Pekka sent, the Arabic numbers work perfectly fine, but when anyone enters any of the Indian numerals I get the message from the validation function that says, user is allowed to enter numbers only ... – Naruto Nov 10 '10 at 07:16
-
Does this answer your question? [Regular Expression Arabic characters and numbers only](https://stackoverflow.com/questions/29729391/regular-expression-arabic-characters-and-numbers-only) – Liam Mar 18 '22 at 16:54
3 Answers
23
Try this one:
/[\u0660-\u0669]/
Example:
var arNumbers = '٠١٢٣٤٥٦٧٨٩'
,reg_arNumbers = /^[\u0660-\u0669]{10}$/;
if (reg_arNumbers.test(arNumbers))
alert("10 Arabic Numerals");
else
alert("Non-Arabic Numerals");

Layal - ليال
- 908
- 6
- 13
-
I added (\u0660-\u0669) to the regular expression and it worked perfectly fine ... thanks nightS :) – Naruto Nov 10 '10 at 07:51
-
You're most welcome..Your question actually made me realize that I have to update my validation functions as well =D So thank you too! – Layal - ليال Nov 10 '10 at 12:31
-
Is possible to allow arabic numbers in the input text even if the user write it in english ? – Mohammed Moustafa Jan 18 '16 at 09:57
2
You can use [^[:digit:]]
.
This will return any digit no matter which language including mixed languages

OhadM
- 4,687
- 1
- 47
- 57
0
This is likely the result of unicode vs. ASCII - the regular expression should be trivial otherwise.

Ofir
- 8,194
- 2
- 29
- 44