html ='Новое содержимое <script type="text/javascript">alert(1);<\/script>'; html = html.replace(/<\/script\>/,'<\\x2fscript>'); alert(html);