Replace quotes with curly quotes
Posted: Wed Jun 06, 2007 5:24 am
I am trying to replace quotes with nice curly quotes, however, I have run into a slight hiccup.
I am parsing whole articles of text which contain HTML; this is where the problem lies. I want to replace quotes, but leave quotes in tags alone. If the following text is what I was parsing:
I would only want to match:
I tried using the expression:
However it seems to ignore the last negative lookahead.
Anyone have any ideas why, or a better expression I could use as an alternative?
P.S. I know this current expression as it is isn't fullproof, however it doesn't need to be.
I am parsing whole articles of text which contain HTML; this is where the problem lies. I want to replace quotes, but leave quotes in tags alone. If the following text is what I was parsing:
Code: Select all
<span class="strong">"Hello"</span> he said, "My name is someberry.".Code: Select all
"Hello"
"My name is someberry."Code: Select all
'#(?<!=)"(.*?)"(?!>)#i'Anyone have any ideas why, or a better expression I could use as an alternative?
P.S. I know this current expression as it is isn't fullproof, however it doesn't need to be.