JSFiddle - React, Tailwind, and code Playground
JavaScript
var e = new RegExp('(\b|^|[^A-Za-z])(Word)(\b|[^A-Za-z]|$)', 'gi');
var text1 = 'Example word. Even when word, is next to a symbol.Word';
var text2 = 'Word Example';
var text3 = 'Example Word';
var text4 = 'word';
if ( text1.match(e) )
console.log('Found Match Inside 1');
if ( text2.match(e) )
console.log('Found Match Inside 2');
if ( text3.match(e) )
console.log('Found Match Inside 3');
if ( text4.match(e) )
console.log('Found Match Inside 4');
console.log(text1.replace(e, '($1)($2)($3)'));
console.log(text2.replace(e, '($1)($2)($3)'));
console.log(text3.replace(e, '($1)($2)($3)'));
console.log(text4.replace(e, '($1)($2)($3)'));