Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9157087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:55:39+00:00 2026-06-17T12:55:39+00:00

Sorry if this has been asked before but I cannot find the answer anywhere..

  • 0

Sorry if this has been asked before but I cannot find the answer anywhere..

I am trying to use regex to extract element values but the xml being pulled contains a blank line and this seems to be causing errors.

Here is one of the elements in the XML:

<entry>
    <id>http://feeds.rasset.ie/rteavgen/player/videos/show/?id=10103822</id>
    <showid>10103822</showid>
    <platform>iptv</platform>
    <published>2013-01-19T21:45:00+00:00</published>
    <updated>2013-01-19T23:41:00+00:00</updated>
    <title type="text">The Saturday Night Show</title>
    <content type="text">Chat show, presented by journalist and broadcaster Brendan O'Connor, featuring comedy, celebrity guests and live musical performances.</content>
    <category term="RTÉ One" rte:type="channel"/>
    <category term="Entertainment" rte:type="genre"/>
    <category term="None" rte:type="series"/>
    <category term="None" rte:type="episode"/>
    <category term="None" rte:type="ranking"/>
    <category term="1024" rte:type="genrelist"/>
    <category term="None" rte:type="keywordlist"/>
    <category term="1668" rte:type="progid"/>
    <link rel="self" type="application/atom+xml" href="http://feeds.rasset.ie/rteavgen/player/playlist?showId=10103822"/>

    <link rel="alternate" type="text/html" href="http://www.rte.ie/player/#v=10103822"/>
    <rte:valid start="2013-01-19T21:52:12+00:00" end="2013-02-09T21:52:12+00:00"/>
    <rte:duration ms="4201061" formatted="1:10"/>
    <rte:statistics views="194"/>
    <media:title type="plain">The Saturday Night Show</media:title>
    <media:description type="plain">Chat show, presented by journalist and broadcaster Brendan O'Connor, featuring comedy, celebrity guests and live musical performances.</media:description>
    <media:player url="http://feeds.rasset.ie/rteavgen/player/player/?id=" width="400" height="300"/>
    <media:thumbnail url="http://img.rasset.ie/0006e56a.jpg" time="00:00:00+00:00"/>
    <media:restriction relationship="allow" type="country"/>
    <media:restriction relationship="disallow" type="country"/>
    <media:copyright>RTÉ</media:copyright>
</entry>

You can see between the two “link rel=” elements there is a blank line.

When I try to use this regex command it throws the Timeout! error as I’m not handling this properly (Excuse me also as my regex knowledge is almost zero).

links = (re.compile ('<showid>(.+?)</showid>\n        ' \
                         '<platform>.+?</platform>\n        ' \
                         '<published>(.+?)</published>\n        ' \
                         '<updated>.+?</updated>\n        ' \
                         '<title type="text">(.+?)</title>\n        ' \
                         '<content type="text">(.+?)</content>\n        ' \
                         '<category term="(.+?)" rte:type="channel"/>\n        ' \
                         '<category term=".+?" rte:type="genre"/>\n        ' \
                         '<category term=".+?" rte:type="series"/>\n        ' \
                         '<category term=".+?" rte:type="episode"/>\n        ' \
                         '<category term=".+?" rte:type="ranking"/>\n        ' \
                         '<category term=".+?" rte:type="genrelist"/>\n        ' \
                         '<category term=".+?" rte:type="keywordlist"/>\n        ' \
                         '<category term=".+?" rte:type="progid"/>\n        ' \
                         '<link rel="self" type=".+?" href=".+?" />\n        ' \
                         '<link rel="alternate" type=".+?" href=".+?" />').findall(data))

I only actually want a few of the fields but I can’t seem to find a regex command that allows me to just select the individual element names I want, it makes me enter each one in sequence (again, my lack of regex knowledge is the issue). There are fields that I require beyond the second “link rel=” element that I require but as it keeps falling over on this one I have left them out for now.

Anyone know what regex command I need to skip the blank line and also perhaps to tidy up the expression to only extract the elements that I require?

Thanks for your help folks, I hope…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:55:41+00:00Added an answer on June 17, 2026 at 12:55 pm

    You should not be using regexes for this task, as others have said.

    Answering your actual question: You are being too specific about the whitespace between elements. In this case it’s extra whitespace that’s causing you a problem. It could have easily been NO whitespace:

    <category term="None" rte:type="ranking"/><category term="1024" rte:type="genrelist"/>
    

    Remedy: Instead of using \n followed by 8 spaces, use \s* (zero or more whitespace characters).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this has been asked before, but I couldn't find a good example
Sorry if this has been asked before, I did check but couldn't find anything...
Sorry if this has been asked before but I've tried searching and can't find
Sorry if this question has been asked before but I couldn't find a good
Sorry if this has been asked before, but I couldn't find a solution to
Sorry if this has been asked before, but I would like a concise answer
Sorry if this has been asked before, I searched but couldn't find anything. I'm
Sorry if this has been asked before, but I can't find a clear enough
Sorry if this has been asked before. I couldn't find a definitive answer. Can
Sorry if this has been asked before, but I am wondering what the use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.