replace
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<button onclick="Function()">click it</button>
<p id="demo">Paul,Paula,Pauline,paul,Paul</p>
<script>
function Function(){
var str="Paul,Paula,Pauline,paul,Paul";
var txt=str.replace(/\bPaul\b/g,"Ringo");
document.getElementById("demo").innerHTML=txt;
}
</script>
</body>
</html>