If the problem is / then you can try:
var test = "abc.com abc.com/help abc.com abc.com?test abc.com";
var content = "abc\\.com";
var replaceContent = "xyz";
var replaceRegexp = new RegExp("\\b" + content + "(?!/)\\b","g");
test = test.replace(replaceRegexp,replaceContent);
console.log(test); // xyz abc.com/help xyz xyz?test xyz
If the problem is that you want the content when not followed by another string, then you can try:
var test = "abc.com something/abc.com abc.com/help abc.com abc.com?test abc.com";
var content = "abc\\.com";
var replaceContent = "xyz";
var replaceRegexp = new RegExp("\\b" + content + "(?=\\s|$)","g");
test = test.replace(replaceRegexp,replaceContent);
console.log(test); // xyz something/xyz abc.com/help xyz abc.com?test xyz
If the problem is that you want the content when not part of another string, then you can try:
var test = "abc.com something/abc.com abc.com/help abc.com abc.com?test abc.com";
var content = "abc\\.com";
var replaceContent = "xyz";
var replaceRegexp = new RegExp("(\\s|^)" + content + "(?=\\s|$)","g");
test = test.replace(replaceRegexp, '$1' + replaceContent);
console.log(test); // xyz something/abc.com abc.com/help xyz abc.com?test xyz
Update: Finally, as mentioned by RobG, the . in content will have to be escaped
If there will only be a ., then a simple content.replace('.', '\\.') will do the job ..or content.replace(/\./g, '\\$&') if there will be more than one
For a more comprehensive approach, try this:
var test = "abc.com abcdcom something/abc.com abc.com/help abc.com abc.com?test abc.com";
var content = "abc.com";
var replaceContent = "xyz";
var rQuantifiers = /[-\/\\^$*+?.()|[\]{}]/g;
var replaceRegexp = new RegExp("(\\s|^)" + content.replace(rQuantifiers, '\\$&') + "(?=\\s|$)","g");
test = test.replace(replaceRegexp, '$1' + replaceContent);
console.log(test); // xyz abcdcom something/abc.com abc.com/help xyz abc.com?test xyz
/is also considered to be word boundary. How exactly you want to replace?