Topic: JS replce issue

if i want replace with this values in <div id="abc"> is it possible to change value only not in the <a> tag or any attribute.
---------------------------------------------------------------------------------------------------------------------------------------------
replace value::

Old value = test
New value = <span class="abc">test1-test2</span>

---------------------------------------------------------------------------------------------------------------------------------------------
Example:

<a href="test.html" title="test">This is a test 123, hello this is test.</a>
---------------------------------------------------------------------------------------------------------------------------------------------

Thanks in Advance