的非贪婪匹配*鉴于字符串: s = "Why did you foo bar a <b>^f('y')[f('x').get()]^? and ^f('barbar')^</b>"
如何用字符串,例如更换^f('y')[f('x').get()]^和^f('barbar')^PLACEXHOLDER? 所需的输出是: Why did you foo bar a <b>PLACEXHOLDER?
我想要得到的只有“文本3”的部分用下面的代码: import re
stringtotest = "begin:Text1<wrong>Text2<wrong>Text3<right>Text4<wrong>"
right = re.findall("<wrong>(.+?)<right>",stringtotest)
>>> right
['Text2<wrong>Text3']
为