Jul-06-2023, 02:06 PM
Hi,
I have this code:
but I want to update my code so that it inserts a new line after that pattern, please help. I want to have:
I have this code:
Quote:text = """MyCo Please have a look at this building’s premium. It looks to be a very high rate. <img width="874" height="162" id="Picture_x0020_2" src="cid:[email protected]" alt="A picture containing text, screenshot, font, algebra
Description automatically generated" style="width:9.1in; height:1.6833in"> The client has a few policies with MyCo as supporting business. 000000123 BonaNou Family T. Please revert back asap. Thanks Sta Sel: 000 00000 pos: [email protected] Lid van:Quanta Primary Cooperative Ltd.
SANTAM Please have a look at this building’s premium. It looks to be a very high rate. <img width="874" height="162" id="Picture_x0020_2" src="cid:[email protected]" alt="A picture containing text, screenshot, font, algebra
Description automatically generated" style="width:9.1in; height:1.6833in"> The client has a few policies with MyCo as supporting business. 000000123 BonaNou Family T. Please revert back asap. Thanks Sta Sel: 000 00000 pos: [email protected] Lid van:Quanta Primary Cooperative Ltd.
<img width="874" height="162" id="Picture_x0020_2" src="cid:[email protected]" alt="A picture containing text, screenshot, font, algebra
Description automatically generated" style="width:9.1in; height:1.6833in"> Dear Mr Smith King thank you and your team for all the assistance throughout the years. Unfortunately, I have decided to depart from Origin and MyCo for personal reasons. I've attached the cancellation letter for my policy to be implemented immediately.Kind Regards """
pattern = re.compile(r'<(img.+.+)>', re.DOTALL)My code matches all these patterns
Quote:<img width="874" height="162" id="Picture_x0020_2" src="cid:[email protected]" alt="A picture containing text, screenshot, font, algebra
Description automatically generated" style="width:9.1in; height:1.6833in">
but I want to update my code so that it inserts a new line after that pattern, please help. I want to have:
Quote:<img width="874" height="162" id="Picture_x0020_2" src="cid:[email protected]" alt="A picture containing text, screenshot, font, algebra
Description automatically generated" style="width:9.1in; height:1.6833in">
Dear Mr Smith King thank you and your team for all the assistance throughout the years. Unfortunately, I have decided to depart from Origin and MyCo for personal reasons. I've attached the cancellation letter for my policy to be implemented immediately.Kind Regards