Help with quote marks in regular expressions
Hi,
I am writing a plugin that needs to remove a space following the quote mark in the expression:
<p>'
I have looked on the web for solutions. One solution was to use triple quote marks so I tried:
html = re.sub(r'''<p>' ''', r'''<p>'''', html)
but this produced the error: EOL while scanning string literal.
I tried escaping the single quote mark in the replacement expression but that also produced an error.
Another web solution suggested placing the regular expressions in double quotes, so I tried the following and it worked:
html = re.sub(r"<p>' ", r"<p>'", html)
My question is: Suppose I have a replacement expression that contains both single and double quote marks. How could I write a replacement expression that includes a mixture of both?
|