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