Then you did something wrong, because it does work
Test case:
code:
var str = "aaaaaaaaaaaaaaaaaaa"
var str1 = str.replace("a","A");
Debug.Trace(str1);
var str2 = str.replace(/a/g,"A");
Debug.Trace(str2);
returns:
code:
Aaaaaaaaaaaaaaaaaaa
AAAAAAAAAAAAAAAAAAA
-----------------------
to ignore links do something like
code:
if (!str.match('www') && !str.match('http')) { // it's not a link }