const HebrewUnicodeBlock = /[\u0590-\u05FF]/; // Hebrew, Yiddish, Ladino (112 code points)
const str1 = "שלוםhello";
if (HebrewUnicodeBlock.test(str1)) {
console.log("The string contains Hebrew characters.");
} else {
console.log("The string does not contain Hebrew characters.");
}
const str2 = "שלום";
if (HebrewUnicodeBlock.test(str2)) {
console.log("The string contains Hebrew characters.");
} else {
console.log("The string does not contain Hebrew characters.");
}
const str3 = "hello";
if (HebrewUnicodeBlock.test(str3)) {
console.log("The string contains Hebrew characters.");
} else {
console.log("The string does not contain Hebrew characters.");
}
/*
run:
The string contains Hebrew characters.
The string contains Hebrew characters.
The string does not contain Hebrew characters.
*/