Skip to content Skip to sidebar Skip to footer

Regular Expression For Arabic Numbers

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 En

Solution 1:

Try this one:

/[\u0660-\u0669]/

Example:

var arNumbers = '٠١٢٣٤٥٦٧٨٩'
    ,reg_arNumbers = /^[\u0660-\u0669]{10}$/;

if (reg_arNumbers.test(arNumbers))
     alert("10 Arabic Numerals");
elsealert("Non-Arabic Numerals"); 

Solution 2:

You can use [^[:digit:]].

This will return any digit no matter which language including mixed languages

Solution 3:

This is likely the result of unicode vs. ASCII - the regular expression should be trivial otherwise.

Post a Comment for "Regular Expression For Arabic Numbers"