Persian characters are within the Arabic Unicode block, which ranges from U+0600 to U+06FF (which is specified in character class as \u0600-\u06FF).
function just_persian(str){
var p = /^[\u0600-\u06FF\s]+$/;
if (!p.test(str)) {
alert("not format");
}
}
Adapted to JavaScript from this question: Regex for check the input string is just in persian language