Isd there an Alternative to Replace() function in javascript

Hello i am developing an advanced ebay store and listing and would like to use jquery with it. Now i want to stay well in ebays rules and use javascript that they have deamed safe. I know of 2 ways of bypassing there detection script to use code that they have banned but i dont want to do this and stick to the rules incase they see my listing and ban me or someone or a competitor reports me.

At present ebay has banned these functions - javascript (“.cookie”, “cookie(”, “replace(”, IFRAME, META, or includes), cookies or base href.
now the standard Jquery application has replace() all over it. My question is - is there another javascript function i could use in place of Replace() in jquery and i will just go through it and add the new function in place of Replace()? Or can i create a new function in pure javascript to replicate the replace() functionality

Kind regards

Just off the top of my head, you could split a string based on the old value and join it again with the new value. Something like this:


function fakeReplace(str, substr, newstr) {
    return str.split(substr).join(newstr);
}

Obviously, there are some pretty big caveats:

  • You can’t use regular expressions.
  • It’s case sensitive.
  • I have no idea how you could integrate this into jQuery, other than changing every single “replace” reference.

Thanks sdleihssirhc for your reply. After some research in other places i also came to the realisation that i could use your solution but i think it should work with regular expressions i just did this to test it and it worked and other places have said regular expresions work with split.


var str="00 000 00 000 00 000";
var patt1=/\\d{3}/g;
str = str.split(patt1).join("111"); 
document.write(str);

Thanks for your help i’m now going to change every “replace()” ref in the jquery code and see if its still works. there is 60 uses of it in the code base. it may slow it up some as replace is much quicker than split join, but hopefully it wont be that noticeable. Thanks