Reputation:
In English it works well, but in Arabic I don't know why
const myText = "here";
console.log(/\bhere\b/.test(myText)); // true
// in Ar
const myText = "السلام";
console.log(/\bالسلام\b/.test(myText)); // false
Upvotes: 0
Views: 55
Reputation: 96
Just use unicode entities:
const myText = "السلام";
console.log(/\s*\u0627\u0644\u0633\u0644\u0627\u0645\s*/.test(myText)); //true
Upvotes: 1