import re
regex = re.compile(r"\"\K[^\"]*?feedsportal.*?(?=\")")
test_str = "src=\"http://rss.feedsportal.com/c/669/f/9809/s/3b7b71e8/sc/5/mf.gif\" border=\"0\" /><br clear='all'/><br /><br /><a href=\"http://da.feedsportal.com/r/199108411625/u/49/f/9809/c/669/s/3b7b71e8/sc/5/rc/1/rc.htm\" rel=\"nofollow\"><img src=\"http://da.feedsportal.com/r/199108411625/u/49/f/9809/c/669/s/3b7b71e8/sc/5/rc/1/rc.img\" border=\"0\" /></a><br /><a href=\"http://da.feedsportal.com/r/199108411625/u/49/f/9809/c/669/s/3b7b71e8/sc/5/rc/2/rc.htm\" rel=\"nofollow\"><img src=\"http://da.feedsportal.com/r/199108411625/u/49/f/9809/c/669/s/3b7b71e8/sc/5/rc/2/rc.img\" border=\"0\" /></a><br /><a href=\"http://da.feedsportal.com/r/199108411625/u/49/f/9809/c/669/s/3b7b71e8/sc/5/rc/3/rc.htm\" rel=\"nofollow\"><img src=\"http://da.feedsportal.com/r/199108411625/u/49/f/9809/c/669/s/3b7b71e8/sc/5/rc/3/rc.img\" border=\"0\" /></a><br /><br /><a href=\"http://da.feedsportal.com/r/199108411625/u/49/f/9809/c/669/s/3b7b71e8/sc/5/a2.htm\"><img src=\"http://da.feedsportal.com/r/199108411625/u/49/f/9809/c/669/s/3b7b71e8/sc/5/a2.img\" border=\"0\" /></a><img width=\"1\" height=\"1\" src=\"http://pi.feedsportal.com/r/199108411625/u/49/f/9809/c/669/s/3b7b71e8/sc/5/a2t.img\" border=\"0\" />"
subst = ""
result = regex.sub(subst, test_str)
if result:
print(result)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html