Performs regular expression operations on an subject string, and sets the results to a property. There are two different operations that can be performed:
Table C.87: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
property | String | The name of the property to set. | n/a | Yes |
override | Boolean | If the property is already set, should we change it's value. Can be true or false | false | No |
subject | String | The subject to be processed | n/a | Yes |
pattern | String | The regular expression pattern which is matched in the subject. | n/a | Yes |
match | String | A pattern which indicates what match pattern you want in the returned value. This uses the substitution pattern syntax to indicate where to insert groupings created as a result of the regular expression match. | n/a | Yes (unless a replace is specified) |
replace | String | A regular expression substitition pattern, which will be used to replace the given regular expression in the subject. | n/a | Yes (unless a match is specified) |
casesensitive | Boolean | Should the match be case sensitive | true | No |
limit | Integer | The maximum possible replacements for each pattern in each subject string. Defaults to -1 (no limit). | -1 | No |
defaultValue | Integer | The value to set the output property to, if the subject string does not match the specific regular expression. | n/a | No |
<propertyregex property="pack.name" subject="package.ABC.name" pattern="package\.([^.]*)\.name" match="$1" casesensitive="false" defaultvalue="test1"/> <echo message="${pack.name}"/> <propertyregex property="pack.name" override="true" subject="package.ABC.name" pattern="(package)\.[^.]*\.(name)" replace="$1.DEF.$2" casesensitive="false" defaultvalue="test2"/> <echo message="${pack.name}"/>