
cpinkham at bc2va
Sep 27, 2010, 10:16 PM
Post #4 of 4
(883 views)
Permalink
|
Coming into the thread late, but wanted to comment because I love the power of this feature. * On Fri Sep 24, 2010 at 12:32:46PM -0500, David Engel wrote: > On Fri, Sep 24, 2010 at 05:05:38PM +0100, Stuart Morgan wrote: > > IIRC the original regular expression in the old UI required the following > > form: > > > > %SUBTITLE|"|"% > > > > and it only supported a single character to be prepended/appended. > > I don't recall any single character limitation. I know I used '" ' > and '"\n' in some things I did. Perhaps that limitation crept in in a > rewrite or there were multiple code paths for OSD and non-OSD > replacement. The original regex should not have had any limitations that I know of on the number of characters in any section. I added that code and we still use a slightly more complex version of that same regex in a home-built (well, work-built) configuration management system at work. We use the prepend and append sections for all kinds of things and also added a 4th optional section for a default value if the variable is empty. We call them 'match variables' and use double percent-signs to deliniate them instead of single percent-signs, so I modified our regex slightly at work to account for that. We even support and use a form of recursion, since we loop over the input text multiple times. We have some matches that when their values are substituted form other matches in the text which are then substituted. It's served us rather well for the past ~7 years. Our software has builtin match variables for things like the webserver IP, doc root, etc. and the user can also define their own. > > The mythui conversion changed the regexp slightly so that the prepended > > character appeared at the beginning because this seemed a little clearer. For MythTV purposes and our limited usage, it probably is clearer to put the keyword in the middle. At work, we apply these match replacements on text sizes ranging from 20-30 bytes to 100KB+, and which which include things as simple as a single line text file to a full-blown httpd.conf or virtual host config file to even more complex items, so we matched on exactly %%KEYWORD in order to keep the complexity of the regex down while making sure we didn't pickup something that wasn't intended. -- Chris _______________________________________________ mythtv-theming mailing list mythtv-theming [at] mythtv http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-theming
|