I have the following problem, I am replacing text in a paragraph but when I find special characters like (* ,? or others) instead of replacing it, it adds it. I leave the code to see if you can help me.
Note: here I only put a small example but it always happens to me that find a special character.
var search = "LEYES PARA EL OCÉANO*";
var regex = new RegExp(search,'g');
$("#uno").html($("#uno").text().replace(regex,'<span style="color: #FF0000; font-size: 18px;">'+search+'</span>'));
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<p>Texto original:(LEYES PARA EL OCÉANO*)</p>
<p id="uno">LEYES PARA EL OCÉANO*</p>