Function FindReplaceStrings(SearchString, Key, Replacement, CaseSensitive, WordOnly)


The function FindReplaceStrings constructs a string by searching for every occurrence of a substring (a key) within a search string and replaces it with another string. It returns the constructed string.

     SearchString,    ! (input) a scalar string expression
     Key,             ! (input) a scalar string expression
     Replacement,     ! (input) a scalar string expression
     [CaseSensitive], ! (optional) binary
     [WordOnly]       ! (optional) binary


The string in which you want to find the substring key.
The substring to search for.
The string used to replace Key.
The search will be case sensitive when the value is 1. The default depends on the setting of the option Case_sensitive_string_comparison, and is 1 if this option is ‘On’ and 0 if this option is ‘Off’. The default of the option Case_sensitive_string_comparison is ‘On’.
It is a word only search when this option is set to 1. The default is 0.


As with all string comparisons within AIMMS, the function FindReplaceStrings is case sensitive by default. You can modify this behavior through the option Case_Sensitive_String_Comparison.

Return Value

The function returns the resulting string. If Key is not found, the original string is returned.

See also

The functions FindString, StringOccurrences and FindReplaceNthString.