You need to use RegExp with the tag u, but javascript will not support the unicode regex :( so to solve this problem you have to override \b. \baMeans [^\w]aso for Turkish characters;
[^\wığüşöçĞÜŞÖÇİ] - .
[^\wığüşöçĞÜŞÖÇİ](türkçe)[^\wığüşöçĞÜŞÖÇİ]
türkçe .
türkçe dili destekliyorum
^ $..
(?:^|[^\wığüşöçĞÜŞÖÇİ])(türkçe)(?:[^\wığüşöçĞÜŞÖÇİ]|$)
thats it..
. . . (^|[^\wığüşöçĞÜŞÖÇİ])(türkçe)([^\wığüşöçĞÜŞÖÇİ]|$) $1<span class="match">$2</span>$3.
: , , , javascript
var word = 'İpsum';
var rgx = new RegExp('(^|[^\wığüşöçĞÜŞÖÇİ])(' + word + ')([^\wığüşöçĞÜŞÖÇİ]|$)', 'ig');
$('p, p *').contents().filter(function() {
return this.nodeType === 3;
}).each(function() {
$(this).replaceWith($(this).text().replace(rgx, "$1<span class='match'>$2</span>$3"));
});
var positions = $('.match').map(function() {
return this.getBoundingClientRect().top;
}).get();
div {
font-size: 50px;
}
span.match {
background: gold;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body>
<p>Lorem İpsum dolor sit amet, consectetur adipisicing elit. Aut voluptatum, provident saepe. Culpa animi sint, itaque iure error hic qui blanditiis perspiciatis adipisci, libero quia veritatis dignissimos quasi id cumque!</p>
</body>
Hide result. (, [hi] spe.cial characters). this