Integration Server 10.15 | Built-In Services Reference Guide | String Folder | Summary of Elements in this Folder | pub.string:replace
 
pub.string:replace
WmPublic. Replaces all occurrences of a specified substring with a substitute string.
Input Parameters
inString
String String containing the substring to replace.
searchString
String Substring to replace within inString.
replaceString
String Character sequence that will replace searchString. If this parameter is null or empty, the service removes all occurrences of searchString from inString.
useRegex
String Optional. Flag indicating whether searchString is a regular expression. When regular expressions are used to specify a search string, replaceString may also contain interpolation variables (for example, "$1") that match parenthetical subexpressions in searchString.
Set to:
*true to indicate that searchString is a regular expression.
*false to indicate that searchString is not a regular expression. This is the default.
Output Parameters
value
String Contents of inString with replacements made.
Usage Notes
The pub.string:replace service accepts a regular expression as an input. By default, Integration Server uses the Perl 5 pattern matching provided by the Jakarta ORO libraries. If you want Integration Server to use Java regular expression pattern matching provided in the java.util.regex.Pattern class, set watt.server.usejavaregex to true. After enabling Java regular expression pattern matching, if execution of pub.string:replace service results in the java.util.regex.PatternSyntaxException, you may need to change the syntax of the supplied pattern in searchString. As an example, if your regular expression has a value of “(\\|\*|\?|{)”, it needs to be changed with “(\\|\*|\?|\{)” i.e., characters like { or }, need to be escaped with \.
Important:
The Jakarta ORO project was retired by Apache in September 2010 because there were not any new features or releases planned. Software AG strongly recommends modifying regular expressions that relied on Perl 5 pattern matching to use Java regular expressions.The java.util.regex.Pattern class API documentation can be found here: https://docs.oracle.com/en/java/javase/11/docs/api/index.html The section “Comparison to Perl 5” identifies Perl 5 constructs that are not supported by java.util.regex.Pattern. Keep in mind that there could be issues that are not described in the documentation.
Note:
The watt.server.usejavaregex parameter and the use of Perl 5 regular expression pattern matching as the default was introduced in PIE-80824 (IS_10.15_Core_Fix4 and higher). Prior to application of this fix, Integration Server 10.15 did not include the Jakarta ORO libraries. As a result, Integration Server performed Java regular expression pattern matching as described in the java.util.regex.Pattern class.