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
Products
TV-Server
[Plugin] EPG Cleaner & Schedule Repair
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="hurley" data-source="post: 1171906" data-attributes="member: 151395"><p>From an efficiency or simplicity point of view..?</p><p>I went with regex for the flexibility, so I can be confident no matter what the TV networks stuff into my guide data, there is a regex pattern that will fix it.</p><p>You are right though, most use cases could be achieved with a simple <a href="https://msdn.microsoft.com/en-us/library/system.string.replace%28v=vs.110%29.aspx" target="_blank">String.Replace</a>.</p><p></p><p>The plugin uses <a href="https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.replace%28v=vs.110%29.aspx" target="_blank">Regex.Replace</a> for most operations combined with <a href="https://msdn.microsoft.com/en-us/library/twcw2f1c%28v=vs.110%29.aspx" target="_blank">Regex.Match</a> for moving text to the description field.</p><p>From a usage angle: A regex pattern '<em>foo</em>' and replace with '<em>bar</em>' will work just the same as String.Replace except that this will replace only the first found '<em>foo</em>' unless the option: '<em>Filters process all matches</em>' is enabled.</p><p></p><p>I was concerned about the overhead of using regex, so I did a lot of real world benchmarking the various techniques Static/Instance/Compiled etc..</p><p>Surprisingly the winner proved to be the instance constructor, which <a href="https://msdn.microsoft.com/en-us/library/gg578045%28v=vs.110%29.aspx" target="_blank">msdn</a> states is not cached but in testing it most certainly is some 5-10 times faster after the first use and out-performs both Static and Compiled options in this use case.</p><p>I guess it goes to show, optimizing without benchmarking can be a fools errand.</p><p></p><p>There is a bit of a learning curve with regex, but the learning is worth it. <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p>What in particular would you like to achieve that would benefit from using String.Replace?</p><p>I'm happy to take on board feedback and make adjustments, which would improve the plugin.</p></blockquote><p></p>
[QUOTE="hurley, post: 1171906, member: 151395"] From an efficiency or simplicity point of view..? I went with regex for the flexibility, so I can be confident no matter what the TV networks stuff into my guide data, there is a regex pattern that will fix it. You are right though, most use cases could be achieved with a simple [URL='https://msdn.microsoft.com/en-us/library/system.string.replace%28v=vs.110%29.aspx']String.Replace[/URL]. The plugin uses [URL='https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.replace%28v=vs.110%29.aspx']Regex.Replace[/URL] for most operations combined with [URL='https://msdn.microsoft.com/en-us/library/twcw2f1c%28v=vs.110%29.aspx']Regex.Match[/URL] for moving text to the description field. From a usage angle: A regex pattern '[I]foo[/I]' and replace with '[I]bar[/I]' will work just the same as String.Replace except that this will replace only the first found '[I]foo[/I]' unless the option: '[I]Filters process all matches[/I]' is enabled. I was concerned about the overhead of using regex, so I did a lot of real world benchmarking the various techniques Static/Instance/Compiled etc.. Surprisingly the winner proved to be the instance constructor, which [URL='https://msdn.microsoft.com/en-us/library/gg578045%28v=vs.110%29.aspx']msdn[/URL] states is not cached but in testing it most certainly is some 5-10 times faster after the first use and out-performs both Static and Compiled options in this use case. I guess it goes to show, optimizing without benchmarking can be a fools errand. There is a bit of a learning curve with regex, but the learning is worth it. :) What in particular would you like to achieve that would benefit from using String.Replace? I'm happy to take on board feedback and make adjustments, which would improve the plugin. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Products
TV-Server
[Plugin] EPG Cleaner & Schedule Repair
Contact us
RSS
Top
Bottom