Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<channel>
<title><![CDATA[English // marca]]></title>
<link>http://www.marca.com</link>
<description><![CDATA[English // marca]]></description>
<language>es</language>
<copyright><![CDATA[(c) 2019, Unidad Editorial, S.A.]]></copyright>
<pubDate>Sat, 23 Feb 2019 10:01:50 +0100</pubDate>
<lastBuildDate>Sat, 23 Feb 2019 10:01:50 +0100</lastBuildDate>
<category><![CDATA[News & Politics]]></category>
<ttl>60</ttl>
<atom:link href="https://e00-marca.uecdn.es/rss/en/index.xml" rel="self" type="application/rss+xml" />
<image>
<title><![CDATA[English // marca]]></title>
<url>http://estaticos.marca.com/imagen/canalima144.gif</url>
<link>https://www.marca.com</link>
<width>144</width>
<height>24</height>
<description><![CDATA[marca.com]]></description>
</image>
<item>
<title><![CDATA[Hazard deal goes cold thanks to FIFA... And Real Madrid]]></title><description><![CDATA[ <a href="https://www.marca.com/en/football/real-madrid/2019/02/23/5c7079d7e2704ee9b38b45a2.html"> Leer </a><img src="http://secure-uk.imrworldwide.com/cgi-bin/m?cid=es-widgetueditorial&cg=rss-marca&ci=es-widgetueditorial&si=https://e00-marca.uecdn.es/rss/en/index.xml" alt=""/>]]></description><dc:creator><![CDATA[marca.com]]></dc:creator><link>https://www.marca.com/en/football/real-madrid/2019/02/23/5c7079d7e2704ee9b38b45a2.html</link><media:description type="html"><![CDATA[A potential transfer to take <strong>Eden Hazard to Real Madrid</strong> looks less likely than ever at present, with a number of factors completely changing the complex of the sit]]></media:description><media:title type="html"><![CDATA[REAL MADRID|Unsure after form of Vinicius and Rodrygo's arrival]]></media:title><media:content url="https://e00-marca.uecdn.es/assets/multimedia/imagenes/2019/02/23/15508796541256.jpg" medium="image" width="650" height="366" /><media:thumbnail url="https://e00-marca.uecdn.es/assets/multimedia/imagenes/2019/02/23/15508796541256_150x0.jpg" width="150" height="84" /><guid>https://www.marca.com/en/football/real-madrid/2019/02/23/5c7079d7e2704ee9b38b45a2.html</guid>
<pubDate>Sat, 23 Feb 2019 01:11:14 +0100</pubDate>
</item>
<item>
<title><![CDATA[Modric and the club of legends]]></title><description><![CDATA[ <a href="https://www.marca.com/en/football/real-madrid/2019/02/23/5c707443e2704ee9b38b459b.html"> Leer </a><img src="http://secure-uk.imrworldwide.com/cgi-bin/m?cid=es-widgetueditorial&cg=rss-marca&ci=es-widgetueditorial&si=https://e00-marca.uecdn.es/rss/en/index.xml" alt=""/>]]></description><dc:creator><![CDATA[marca.com]]></dc:creator><link>https://www.marca.com/en/football/real-madrid/2019/02/23/5c707443e2704ee9b38b459b.html</link><media:description type="html"><![CDATA[He may already be in <a href="https://www.marca.com/en/football/real-madrid.html?intcmp=MENUPROD&s_kw=english-real-madrid"><strong>Real Madrid</strong></a>'s history books with fou]]></media:description><media:title type="html"><![CDATA[REAL MADRID|Could become the sixth oldest player to retire at the Bernabeu]]></media:title><media:content url="https://e00-marca.uecdn.es/assets/multimedia/imagenes/2019/02/23/15508801724875.jpg" medium="image" width="140" height="79" /><media:thumbnail url="https://e00-marca.uecdn.es/assets/multimedia/imagenes/2019/02/23/15508801724875_150x0.jpg" width="150" height="84" /><guid>https://www.marca.com/en/football/real-madrid/2019/02/23/5c707443e2704ee9b38b459b.html</guid>
<pubDate>Sat, 23 Feb 2019 01:10:39 +0100</pubDate>
</item>
<item>
<title><![CDATA[Messi and Suarez have unfinished business with goals]]></title><description><![CDATA[ <a href="https://www.marca.com/en/football/barcelona/2019/02/23/5c707d7ee2704e8e3e8b45eb.html"> Leer </a><img src="http://secure-uk.imrworldwide.com/cgi-bin/m?cid=es-widgetueditorial&cg=rss-marca&ci=es-widgetueditorial&si=https://e00-marca.uecdn.es/rss/en/index.xml" alt=""/>]]></description><dc:creator><![CDATA[marca.com]]></dc:creator><link>https://www.marca.com/en/football/barcelona/2019/02/23/5c707d7ee2704e8e3e8b45eb.html</link><media:description type="html"><![CDATA[<strong>Barcelona</strong>'s lack of goals of late is clear, with just one in three games and even then coming from a penalty.It has shown that the side aren't in their best form]]></media:description><media:title type="html"><![CDATA[BARCELONA|Both are in poor scoring form]]></media:title><media:content url="https://e00-marca.uecdn.es/assets/multimedia/imagenes/2019/02/23/15508797785155.jpg" medium="image" width="140" height="79" /><media:thumbnail url="https://e00-marca.uecdn.es/assets/multimedia/imagenes/2019/02/23/15508797785155_150x0.jpg" width="150" height="84" /><guid>https://www.marca.com/en/football/barcelona/2019/02/23/5c707d7ee2704e8e3e8b45eb.html</guid>
<pubDate>Sat, 23 Feb 2019 01:09:50 +0100</pubDate>
</item>
Goal to achieve: get <channel>'s content (without the <channel> part, or the <item>-s) in the first capture group, and the first <item> in the second capture group - by the way, the issue I have is with the first capture group, not the second (the latter works fine)
The above regex is relatively close to what I want to achieve, but it fails when the test string is null, for example. I want everything from <channel> to the first occurence of an <item> to be captured, but I want to do it using lookahead conditional (just like the first <item> is captured), so that it won't fail and it returns "" if the string lacks the captured part.