try the following in IE6, although it may not work with IE5, also the regex makes no other assumptions, so if you have other kind of strings, the following may not work
<script>
function rep(s)
{
if (s.toLowerCase() == "def")
return "opq";
else if (s.toLowerCase() == "jkl")
return "mno";
else
return s;
}