Как вариант...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="https://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<!--
-->
<style>
</style>
<script>
$(_ => {
const val = 'Hi'
const str = 'Hello'
$(':contains("'+ val +'")').each((i, o) => {
if (o.tagName === 'SCRIPT') return
o.childNodes.forEach(o => {
if (o.nodeType !== Node.TEXT_NODE) return
if (o.nodeValue.indexOf(val) === -1) return
o.nodeValue = o.nodeValue.replace(val, str)
})
})
})
</script>
</head>
<body>
<div>
<p>Hi man</p>
</div>
</body>
</html>