JSFiddle - React, Tailwind, and code Playground

JavaScript

// Source string
var str = "this is 'a simple' a simple 'string' string";

// RegEx to match all quoted strings.
var QUOTED_EXP = /\'[\w\s\d]+\'/g; 

// Store an array of the unmodified quoted strings in source
var quoted = str.match(QUOTED_EXP); 

// Do any desired replacement
str = str.replace('s', 'p'); // Do the replacement

// Put the original quoted strings back
str = str.replace(QUOTED_EXP, function(match, offset){
    return quoted.shift();
});

document.body.innerHTML = str;