-1

I have this regex written in JS that allows only Arabic letters.

const onlyArabicCharacters = function (value) {
    if (!value) return true;
    var ARRegex = /[\u0600-\u06FF\s]/;
    var str = value;
    for (var i = 0; i < value.length; i++) {
        if (!ARRegex.test(value.charAt(i)))
            str = str.replace(value.charAt(i), "");
    }
    if (str.length === value.length) return true;
    return false;
};

I would like to also allow Parentheses.
I tried to add them but it didn't work.

Wiktor Stribiżew
  • 561,645
  • 34
  • 376
  • 476
Hassanation
  • 862
  • 2
  • 14
  • 29

0 Answers0