# <replacetokens>

Replaces tokens in the original input with user-supplied values.

This filter replaces all token surrounded by a beginning and ending token. The default beginning and ending tokens both default to '@'. The optional `begintoken` and `endtoken` attributes can be specified to change either token. By default string comparisons are case sensitive but this can be changed by setting the optional `ignorecase` attribute to true.

Tokens are specified by using the Token element. It is possible to specify from 1 to n tokens and replacement values. Values can be any valid NAnt expression.

Filters are intended to be used as a element of a <filterchain>.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
begintoken | char | Marks the beginning of a token. The default is "@". | False
endtoken | char | Marks the end of a token. The default is "@". | False
ignorecase | bool | Determines if case will be ignored. The default is false. | False
if | bool | If true then the filter will be used; otherwise, skipped. The default is true. | False
unless | bool | Opposite of `if`. If false then the filter will be executed; otherwise, skipped. The default is false. | False

### Nested Elements:

#### <token>

Tokens and replacement values.

ReplaceTokens filter token.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
key | string | Token to be replaced. | True
value | string | New value of token. | True
if | bool | Indicates if the token should be used to replace values. If true then the token will be used; otherwise, not. The default is true. | False
unless | bool | Indicates if the token should not be used to replace values. If false then the token will be used; otherwise, not. The default is false. | False

#### </token>

### Examples

- Replace all occurrences of the string @DATE@ with the value of property "TODAY".

      <replacetokens>
          <token key="DATE" value="${TODAY}" />
      </replacetokens>

- Replace all occurrences of the string <DATE> with the value of property "TODAY".

      <replacetokens begintoken="&lt;" endtoken="&gt;">
          <token key="DATE" value="${TODAY}" />
      </replacetokens>

### Requirements

Assembly: NAnt.Core (0.90.3780.0)