You are viewing the documentation for Blueriq 17. Documentation for other versions is available in our documentation directory.
REPLACE
Replaces every occurrence of a string pattern within another string with a provided replacement string. The function is case-sensitive.
Syntax
REPLACE pattern IN string WITH replacement REPLACE ( pattern , string , replacement )
Inputs
- pattern - An attribute of base type string or a string value. String must be a valid regular expression. The regular expressions used in several Blueriq Encore functions are common Java 1.4 expressions. For a complete documentation we refer to the online java documentation.
- string - An attribute of base type string or an expression that results in a string.
- replacement - An attribute of base type string or an expression that results in a string.
Return type
- string. If the pattern is not found, the original string is returned.
Examples
Expression | Result | Type |
---|---|---|
REPLACE ":" IN "hello:world:example" WITH " " | "hello world example" | String |
REPLACE ( "o" , "hello world" , "a" ) | "hella warld" | String |
REPLACE ( "O" , "hello world" , "a" ) | "hello world" | String |
REPLACE "\s" IN "hello world example" WITH "" | "helloworldexample" | String |
REPLACE ( "\d{2}" , "hello1 world22 example333" , "@" ) | "hello1 world@ example@3" | String |
REPLACE ( "" , "hello world" , " " ) | " h e l l o w o r l d " | String |
REPLACE "\s" IN "hello world example" WITH "\s" | "hello\sworld\sexample" | String |
The first argument is a pattern (regular expression) and can therefore contain specials like \s for a space. The second and third arguments are strings or expressions, so \s will result in \s.
Overview
Content Tools