I have a webpage where I want to replace all standard quote characters \"
with the nicer looking quotes. For example, we have
\"hello world\"
<
I might be missing something obvious here, but I think the following RegEx solution would work -
subject = 'test "abc" test "abc"';
result = subject.replace(/"([A-Za-z ]*)"/ig, "“$1”");
alert(result);
If you were using PHP then you could write some similar code in PHP - (my PHP skills are somewhat lacking though! The code below was generated with RegEx Buddy so it hasn't been tested and may need changing)
$subject = 'test "abc" test "abc"';
$result = preg_replace('/"([A-Za-z ]*)"/i', '“$1”', $subject);
Alternatively, you could load the content into a DIV using PHP then use JavaScript to change the DIV contents, here's a bit of JQuery that would do the job -
$("#contentdiv").text($("#contentdiv").text().replace(/"([A-Za-z ]*)"/ig, "“$1”"));
There's a jsfiddle that demonstrates the above JQuery here.