Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Current »

The Contains Condition can be used to check whether string, variable value or file content contains a given pattern.

The pattern can be a plain string or a regular expression.

Usage

Example:

<condition type="contains" id="...">
    <string>a string</string>
    <value>a substring</value>
</condition>
 
<condition type="contains" id="...">
    <variable>a variable</variable>
    <value>a substring</value>
</condition>
 
<condition type="contains" id="...">
    <file>a string</file>
    <value byLine="true" caseInsensitive="false" regex="false">a substring</value>
</condition>

The Contains condition has been introduced in IzPack 5.0.

 Nested Elements

<string>

A source string where to look up the pattern.

Variable substitution takes places before the string is processed by the condition.

Optional, one of the elements <string>, <variable> or <file> must be given to deliver a source for parsing.

<variable>

A variable name, the pattern is looked up in the variable's value.

Optional, one of the elements <string><variable> or <file> must be given to deliver a source for parsing.

<file>

A text file name, the pattern is looked up in the file's content.

Variable substitution takes places before the file name is processed by the condition.e

Optional, one of the elements <string><variable> or <file> must be given to deliver a source for parsing.

Be aware that the given file is opened and parsed quite many times during an installation process each time conditions get to be evaluated, to not slow down the installation process that much.

<value>

The substring or regular expression to look up in the contents.

A value must be given in each case.

Attributes:

NameRequiredDefault ValueDescription

byLine

notrue

Whether to look up an entry on each line separately or just on a compact content.
This is honored in combination with regex="true" only and makes sense especially for file content.
The condition evaluates true, if the expression is found in at least one of the lines.

caseInsensitive

nofalseWhether to look up case-insensitive.

regex

nofalseWhether the value should be considered a Java regular expression pattern for looking up a content.
  • No labels