MessageTransform Class
(Automation::MessageTransform)The MessageTransform
can be used to transform CM_TEXTCOMMAND text messages using POSIX regular expressions. More...
Header: | #include <MessageTransform.h> |
Inherits: | CDPOperator<bool> |
Additional Inherited Members
- 18 public functions inherited from CDPOperator
- 17 public functions inherited from CDPOperatorBase
- 46 public functions inherited from CDPBaseObject
- 26 public functions inherited from CDP::StudioAPI::CDPNode
- 22 public functions inherited from CDP::StudioAPI::ICDPNode
- 1 public variable inherited from CDPOperatorBase
- 1 static public member inherited from CDPBaseObject
- 1 protected function inherited from CDP::StudioAPI::CDPNode
- 8 protected variables inherited from CDPOperator
- 5 protected variables inherited from CDPOperatorBase
- 11 protected variables inherited from CDPBaseObject
Detailed Description
The MessageTransform
can be used to transform CM_TEXTCOMMAND text messages using POSIX regular expressions.
MessageTransform
is similar to the MessageProxy operator allowing to forward CM_TEXTCOMMAND text messages from input arguments to one or multiple output arguments. Only difference is that every CM_TEXTCOMMAND text message is transformed using POSIX regular expression search and replace transform on the message and then forwards it to the configured output arguments.
The MessageTransform argument has the following properties:
Property | Description |
---|---|
Search | POSIX regular expression search pattern with search groups to find from incoming messages. |
Replace | Text to replace matched pattern with (with numbered references to the POSIX regular expression matchs groups like $1, $2 etc). |
Note: The message will be forwarded unchanged when the Search pattern is not matching with the message at all.
For example, the following Search and Replace patterns can be used to change a parameter name ValueName
to SomeOtherName
in between other parameters in the text message:
Property | Description |
---|---|
Search | (.*);ValueName=(*.) |
Replace | $1;SomeOtherName=$2 |
- It is possible to convert incoming CM_TEXTCOMMAND messages to other CM_TEXTCOMMAND commands by setting the received and sent TextCommand property on the (input and/or) output
MessageArgument
.
Note: It is important to keep in mind that MessageTransform will replace the Origin of the message and for that reason is not suitable for forwarding messages that require ACK handling or response
Below is a table with the most useful special characters in patterns:
(...) | Specifies a block (regex group). Anything that is matched inside parenthesis can be references using $1 $2 etc in the Replace field. |
. | Matches any character |
\. | Matches . character (dot) |
\s | Matches any whitespace character (space, tab or newline) |
\S | Matches any non-whitespace character (any character except space, tab and newline) |
\d | Matches any digit character |
\D | Matches any non-digit character |
\w | Matches any alphanumeric character (letter, number or underscore) |
\W | Matches any non-letter character (so it is not a letter, number nor underscore) |
+ | Indicates one or more occurrences of the preceding elements. For example, S+ causes to match one or more sequential non-whitespace characters. |
* | Indicates zero or more occurrences of the preceding elements. For example, S* causes to match any number (or zero) sequential non-whitespace characters. |
You can learn more about regex expression possibilities, at:
See also MessageArgument.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.