Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regular Expression
#1
Hi,

I have this code below:

Import re

Quote:text = """
ATT 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 SEFATE as supporting business. 100000COUTINHO AC Family Trust (501 Missouri)StaHorse Sel: 000 4633353000e pos: [email protected] Lid van:Quanta Primary Ltd NSB Nr: 7777 Quanta Primary Ltd is an Authorised Financial Service Provider.
"""

pattern = re.compile(r'<img.+.+')
matches = pattern.finditer(text)

for match in matches:
    print(match)
Output:
<re.Match object; span=(90, 239), match='<img width="874" height="162" id="Picture_x0020_2>
I wan to get this output:

Output:
<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">
Something is missing in my regular expression but I can't get it right.
Reply


Messages In This Thread
Regular Expression - by stahorse - Jul-05-2023, 06:28 AM
RE: Regular Expression - by Gribouillis - Jul-05-2023, 07:46 AM
RE: Regular Expression - by stahorse - Jul-05-2023, 09:21 AM
RE: Regular Expression - by Gribouillis - Jul-05-2023, 11:51 AM
RE: Regular Expression - by stahorse - Jul-05-2023, 12:10 PM
RE: Regular Expression - by DeaD_EyE - Jul-05-2023, 01:18 PM
RE: Regular Expression - by Will_Robertson - Jul-31-2023, 01:20 PM
RE: Regular Expression - by stahorse - Jul-05-2023, 02:46 PM
RE: Regular Expression - by stahorse - Jul-11-2023, 10:12 AM
RE: Regular Expression - by deanhystad - Jul-12-2023, 11:35 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  regular expression pramod 1 1,583 Jul-10-2020, 06:38 AM
Last Post: karkas
  regular expression pramod 6 3,115 Jul-04-2020, 04:58 AM
Last Post: pramod
  regular expression pramod 4 2,140 Jun-16-2020, 02:01 AM
Last Post: pramod
  regular expression pramod 2 1,677 May-05-2020, 02:36 AM
Last Post: pramod

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020