const regex = /(?<![^(["\s])(?:टीम|UAE|afri)[\u0900-\u097F\w]*/gmi;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(?<![^(["\\s])(?:टीम|UAE|afri)[\\u0900-\\u097F\\w]*', 'gmi')
const str = `इस बार टीम इंडिया के पास टी-20 वर्ल्ड कप में पाक के हाथों 10 विकेट से मिली करारी हार का बदला लेने का मौका होगा। एशिया कप UAE में हो रहा है। इस टी-20 टूर्नामेंट की शुरुआत africa
"africa
" africa
(
africa
टीमइंडियाबदलालेनेकामौकाहोगा।एशिया`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions