I tried a very simple regular expression.
var name = "jon snow"
name = name.replace("/jon/i", "hans");
$("#output").html(name);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p id="output"></p>
I simply try to replace "jon" with "hans" by using regular expressions. But It does not work.
I informed my selve here.
EDIT: My question is obviously completly different from the "duplicate".