Regular Expression for arabic numbers

后端 未结 3 1258
情话喂你
情话喂你 2020-12-31 07:44

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

相关标签:
3条回答
  • 2020-12-31 08:20

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

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

    0 讨论(0)
  • 2020-12-31 08:24

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

    0 讨论(0)
  • 2020-12-31 08:37

    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"); 
    
    0 讨论(0)
提交回复
热议问题