Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fix examples for filters on dynamic variables from windows registry

...

Code Block
langxml
titleFiltering dynamic variable assignments using regular expressions
<dynamicvariables>

	<!--
      Read the property value of release.version in the resource release.properties from the root of the config.jar file.
	  Filter just the version string from the result, if there is one, otherwise return 'none'.
      -->
    <variable name="previous.version" jarfile="${INSTALL_PATH}/${INSTALL_SUBPATH}/libs/config.jar"
              entry="release.properties" type="options"
              key="release.version"
              checkonce="false" ignorefailure="true" condition="upgradecheck">
      <filters>
        <regex regexp="([0-9]+(\.[0-9]+){2})" select="\1" defaultvalue="none"/>
      </filters>
    </variable>

	<!--
      Read the value of the Windows system environment variable %PATH% directly from the Windows registry (can done smarter by ${SYSTEM[PATH]}).
      Filter just the first single path (if there are more separated by the ';' character). If there was a valid value, otherwise return '(unmatched)'.
      -->
    <variable name="RegExTest.Select.Windows" checkonce="true"
              regkey="HKLMHKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
              regvalue="Path">
      <filters>
        <regex regexp="([^;]*)(.*)"
               select="\1"
               defaultvalue="(unmatched)"
               casesensitive="false"/>
      </filters>
    </variable>

	<!--
      Read the value of the Windows system environment variable %PATH% directly from the Windows registry (can done smarter by ${SYSTEM[PATH]}).
      Filter just the first single path (if there are more separated by the ';' character).
	  Prepend and append three plus signs to the resulting value, if there was a valid value, otherwise return '(unmatched)'.
      -->
    <variable name="RegExTest.ReplaceFirst.Windows" checkonce="true"
              regkey="HKLMHKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"
              regvalue="Path">
      <filters>
        <regex regexp="([^;]*)"
               replace="+++ \1 +++"
               defaultvalue="(unmatched)"
               casesensitive="false"
               global="false"/>
      </filters>
    </variable>

</dynamicvariables>

...