Please note that that source code is part of Javascript on the website. So the question is what are you doing with the result of the substitution?
The substitution itself should work:
Quote:
>>> import re
>>> regex = re.compile(r"\\'", re.IGNORECASE | re.DOTALL)
>>> text = r"""Lana is one of 2011\'s biggest success stories. The gorgeous songstress found fame on the internet with her songs \'Video Games\' and \'Blue Jeans\'. Since then she has been everywhere, even singing for the fash pack at the Mulberry pool party in LA. With the soon to be released \'Born To Die\' we will all wonder how we ever coped without her slick vocals. Watch out 2012, Lana is coming!"""
>>> print text
Lana is one of 2011\'s biggest success stories. The gorgeous songstress found fame on the internet with her songs \'Video Games\' and \'Blue Jeans\'. Since then she has been everywhere, even singing for the fash pack at the Mulberry pool party in LA. With the soon to be released \'Born To Die\' we will all wonder how we ever coped without her slick vocals. Watch out 2012, Lana is coming!
>>> print regex.sub(lambda match: "'", text)
Lana is one of 2011's biggest success stories. The gorgeous songstress found fame on the internet with her songs 'Video Games' and 'Blue Jeans'. Since then she has been everywhere, even singing for the fash pack at the Mulberry pool party in LA. With the soon to be released 'Born To Die' we will all wonder how we ever coped without her slick vocals. Watch out 2012, Lana is coming!
|