阿拉伯数字的正则表达式 [英] Regular Expression for arabic numbers
本文介绍了阿拉伯数字的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有验证 JQuery 功能的表单,我的电话字段有问题,我想要的只是让用户只输入数字......它在英语表单上工作得很好,但在阿拉伯语表单上效果很好, 如果我使用阿拉伯语输入数字,表格将不会提交.有谁知道阿拉伯数字的正则表达式是什么??
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 ??
推荐答案
试试这个:
/[\u0660-\u0669]/
示例:
var arNumbers = '٠١٢٣٤٥٦٧٨٩'
,reg_arNumbers = /^[\u0660-\u0669]{10}$/;
if (reg_arNumbers.test(arNumbers))
alert("10 Arabic Numerals");
else
alert("Non-Arabic Numerals");
这篇关于阿拉伯数字的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文