JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = "As http://JavaScript regex engines don't support `lookbehind`, it's not possible to do with plain regex. Still, there's a workaround";

var replaceIfNotPrecededBy = function(notPrecededBy, replacement) {
   return function(match) {
     return match.slice(0, notPrecededBy.length) === notPrecededBy
       ? match
       : replacement;
   }
};
var adjusted = str.replace(/\S+/g, replaceIfNotPrecededBy('http://', 'rocks'));
alert(adjusted);