Like Unicode 6.1, the Arabic script is contained in the following blocks (from
Regular Expression for Arabic )
Arabic (0600—06FF, 225 characters)
Arabic Supplement (0750—077F, 48 characters)
Arabic Extended-A (08A0—08FF, 39 characters)
Arabic Presentation Forms-A (FB50—FDFF, 608 characters)
Arabic Presentation Forms-B (FE70—FEFF, 140 characters)
Rumi Numeral Symbols (10E60—10E7F, 31 characters)
Arabic Mathematical Alphabetic Symbols (1EE00—1EEFF, 143 characters)
Use a regular expression for a text field with any structure used.
var isArabic = /^([\u0600-\u06ff]|[\u0750-\u077f]|[\ufb50-\ufbc1]|[\ufbd3-\ufd3f]|[\ufd50-\ufd8f]|[\ufd92-\ufdc7]|[\ufe70-\ufefc]|[\ufdf0-\ufdfd])*$/g;
$("#txtArabic1").change(function() {
$(this).toggleClass("has-error", !isArabic.test(this.value));
})
$("#txtArabic2").bind('keyup', function(e) {
var filterFn = isArabic.test.bind(isArabic),
newValue = this.value.split('').filter(filterFn).join('');
if (this.value != newValue)
this.value = newValue;
});
Here is jsfiddle
source
share