@ReplaceFirst
@REPLACEFIRST
replaces the first occurrence of the regular expression with the replacement string.
DTP Type:
@REPLACEFIRST
can be assigned to a DTP of type string, password, member, members, dimension, or dimensions.
Snytax:
@REPLACEFIRST(String,Regular Expression,replaceString)
Parameters:
Parameter | Description |
---|---|
String |
Design-time prompt or text |
Regular Expression |
Design-time prompt or text |
replaceString |
Design-time prompt or text |
Example:
[ReplaceFirst_Str]=@REPLACEFIRST([String1],[Rep_String],[new_String])
Where:
-
[ReplaceFirst_Str]
is a DPT of type string that is not a checked prompt. -
[String1]
is a DTP of type string that is a checked prompt. -
[Rep_String]
is a DTP of type string that is a checked prompt. -
[new_String]
is a DTP of type string that is a checked prompt.
Assume that the parameters are as follows:
-
String: "This is a testing of the new test of a test today"
-
Regular Expression: "Test"
-
Replace String: "XYZ"
In this example, [ReplaceFirst_Str]
returns: "This is a XYZing of the new test of a test today". It will only replace the first occurrence of test, not all of the occurrences.