It is currently April 27th, 2024, 8:18 am
Get help with creating, editing & fixing problems with skins
imonline
Posts: 7 Joined: March 26th, 2011, 11:36 pm
Post
by imonline » December 22nd, 2011, 3:00 am
I've searched the forum and couldn't find an answer so here goes:
This is the code I've got:
Code: Select all
RegExp="(?siU)<title.*>(.*)</title>(?(?=.*<item).*<title.*>(.*)</title>)(?(?=.*<item).*<title.*>(.*)</title>)"
And this is what it gives me:
On-My.TV Daily TV Show Guide (22nd Dec 2011)
Conan 2x23 (18:00 Fri 23rd)
Prime Suspect 1x11 (18:00 Fri 23rd)
How do I code this so that I don't get the items between the "()", example: (22nd Dec 2011). Can it be done?
I've read the tutorials, which helped me a lot but I can't figure out how to exclude this data.
Thank you in advance.
If immortality was outlawed then only outlaws would be immortal.
jsmorley
Developer
Posts: 22631 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » December 22nd, 2011, 4:37 am
If we assume what you are going after looks something like this:
Code: Select all
<html>
<body>
<item>
<title>On-My.TV Daily TV Show Guide (22nd Dec 2011)</title>
</item>
<item>
<title>Conan 2x23 (18:00 Fri 23rd)</title>
</item>
<item>
<title>Prime Suspect 1x11 (18:00 Fri 23rd)</title>
</item>
</body>
</html>
Then this RegExp should do the trick:
Code: Select all
(?siU)<title.*>(.*)\(.*</title>(?(?=.*<item).*<title.*>(.*)\(.*</title>)(?(?=.*<item).*<title.*>(.*)\(.*</title>)
Code: Select all
01=> On-My.TV Daily TV Show Guide
02=> Conan 2x23
03=> Prime Suspect 1x11
The
\(.* bit is just asking the capture to end when it hits a "(" character (the "\" is to escape this reserved character) then skip ".*" until it hits "</title>".
imonline
Posts: 7 Joined: March 26th, 2011, 11:36 pm
Post
by imonline » December 24th, 2011, 2:29 am
Thanks a lot! This works great!
My problem was to find the right code for the "(".
Merry Christmas!
If immortality was outlawed then only outlaws would be immortal.