Doesn't seem to work, namely that the string contains ")" not the code for it. I have no control over the original string, hence trying to edit it using replace. I have been using the w3c schools replace demo and trying many things, and I cannot seem to replace the right bracket
<script type="text/javascript">var str=")"document.write(str.replace(/)/,"W3Schools"))</script>
EDIT: Have solved it, fyi:
<script type="text/javascript">var str="(W3Schools)";var bracket=")";document.write(str.replace(bracket," Rocks!"))</script>