home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
Improvement Suggestions
[WebEPG] why not just regex
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="benjerry" data-source="post: 630660" data-attributes="member: 57133"><p>Hi,</p><p></p><p>I was wondering why not just use full regex expressions for template matching tv programs and where ever possible.</p><p></p><p>Current system is perhaps more userfriendly(?), but limited when things get complicated.</p><p></p><p>It's possbile to do the full regex way with creating a template.</p><p></p><p>Example:</p><p></p><p>partly html code from a dutch tvguide (<a href="http://www.tvgids.nl/zoeken/?q=&d=0&z=1&t=0&g=&v=0" target="_blank">TVGids.nl - Zoeken</a>):</p><p></p><p><div class="program"></p><p> <a href="/programma/9519408/Nederland_in_Beweging%21/"></p><p> <span class="time">08:45 - 09:00</span></p><p> <span class="title">Nederland in Beweging!</span></p><p> <span class="channel">Nederland 1</span></p><p> </a></p><p></p><p>template could be like this:</p><p></p><p>TemplateProgram =</p><p><div class="program">[^<]*</p><p><a href="(?<SUBLINK>[^"]*)">[^<]*</p><p><span class="time">(?<START>[^\s]*) - (?<END>[^<]*)</span>[^<]*</p><p><span class="title">(?<TITLE>[^<]*)</span>[^<]*</p><p><span class="channel">(?<CHANNEL>[^<]*)</span>[^<]*</p><p></a></p><p></p><p>some sample sourcecode:</p><p></p><p>Regex ProgramSearch = new Regex(TemplateProgram)</p><p></p><p>MatchCollection ProgramMatches = ProgramSearch.Matches(HtmlPageText)</p><p></p><p>foreach(Match ProgramMatch in ProgramMatches)</p><p>{</p><p> sublink = ProgramMatch.Groups["SUBLINK"].Value;</p><p> starttime = ProgramMatch.Groups["START"].Value;</p><p> endtime = ProgramMatch.Groups["END"].Value;</p><p> title = ProgramMatch.Groups["TITLE"].Value ; </p><p> extrafields.Add("CHANNEL", ProgramMatch.Groups["CHANNEL"].Value);</p><p>}</p><p></p><p>gr,</p><p>Gijs</p></blockquote><p></p>
[QUOTE="benjerry, post: 630660, member: 57133"] Hi, I was wondering why not just use full regex expressions for template matching tv programs and where ever possible. Current system is perhaps more userfriendly(?), but limited when things get complicated. It's possbile to do the full regex way with creating a template. Example: partly html code from a dutch tvguide ([url=http://www.tvgids.nl/zoeken/?q=&d=0&z=1&t=0&g=&v=0]TVGids.nl - Zoeken[/url]): <div class="program"> <a href="/programma/9519408/Nederland_in_Beweging%21/"> <span class="time">08:45 - 09:00</span> <span class="title">Nederland in Beweging!</span> <span class="channel">Nederland 1</span> </a> template could be like this: TemplateProgram = <div class="program">[^<]* <a href="(?<SUBLINK>[^"]*)">[^<]* <span class="time">(?<START>[^\s]*) - (?<END>[^<]*)</span>[^<]* <span class="title">(?<TITLE>[^<]*)</span>[^<]* <span class="channel">(?<CHANNEL>[^<]*)</span>[^<]* </a> some sample sourcecode: Regex ProgramSearch = new Regex(TemplateProgram) MatchCollection ProgramMatches = ProgramSearch.Matches(HtmlPageText) foreach(Match ProgramMatch in ProgramMatches) { sublink = ProgramMatch.Groups["SUBLINK"].Value; starttime = ProgramMatch.Groups["START"].Value; endtime = ProgramMatch.Groups["END"].Value; title = ProgramMatch.Groups["TITLE"].Value ; extrafields.Add("CHANNEL", ProgramMatch.Groups["CHANNEL"].Value); } gr, Gijs [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
Improvement Suggestions
[WebEPG] why not just regex
Contact us
RSS
Top
Bottom