var str = 'remove "foo" delimiting double quotes';
console.log(str.replace(/"([^"]+(?="))"/g, '$1'));
//logs remove foo delimiting quotes
str = 'remove only "foo" delimiting "';//note trailing " at the end
console.log(str.replace(/"([^"]+(?="))"/g, '$1'));
//logs remove only foo delimiting "<-- trailing double quote is not removed
var someStr = 'He said "Hello, my name is Foo"';
console.log(someStr.replace(/['"]+/g, ''));
str.replace(/^["'](.+(?=["']$))["']$/, '$1');
someStr.replace(/^"(.+)"$/,'$1');
str.replace(/^"(.+(?="$))"$/, '$1');
if (str.charAt(0) === '"' && str.charAt(str.length -1) === '"')
{
console.log(str.substr(1,str.length -2));
}