I am new to python and I have been trying to check and substitute a specific value for a string. To illustrate, let me paste the bit of code that I used:-
var1 = re.sub(r'\$this->getSomething()->getSomethingElse()->(.*?)', r'\1', var1)
What I am trying to do here is to replace the entire string(var1) with the value contained within (.*?). E.g if the string is in this format "$this->getSomething()->getSomethingElse()->__('Title')" then the new value for var1 should be "__('Title')." At the moment I can't figure out what's wrong with the code and I tried searching all over the place including stackoverflow but not to avail.
Note : This seems to work well though :-
value = re.sub(r"\$title", "$this->title", value)
I hope someone can help me with this problem or at least direct me in the right direction. Thanks in advance.