Rockwell Automation 2755 Enhanced Decoder Series B User Manual

Page 140

Advertising
background image

10–5

Configuration: Host Message Replacement Rules

Publication 2755-833

Table 10.C Search pattern metacharacters – string
manipulation

Character

Description and Use

?

+

*

Note: These metacharacters refer to the character, metacharacter,
string, or expression that immediately precedes them.

The question mark instructs the rule to match either no occurrence or
one occurrence of what precedes it. This metacharacter is used in a
search string where the character may not appear at all, or may appear
once.

The plus sign instructs the rule to match one or more occurrences of
what precedes it. This metacharacter is used in a search string where the
character will be present, but you are unsure how many times it appears.

The asterisk instructs the rule to match none or more occurrences of
what precedes it. This metacharacter is used in a search string in cases
where the character may not appear, or may appear one or more times.

Table 10.D Search patter metacharacters – logical operators
and other special functions

Character

Description and Use

[ ]

Square brackets ( [ ] ) instructs the rule to match an incoming string if any
character enclosed within the brackets appears in the string. A range of
values can be represented within the brackets by separating the first and
last characters in the range by a hyphen. Square brackets must be used
in pairs.

Note: The circumflex ( ^ ) can be used as the first character within the
square brackets to reverse the sense of the expression.

Examples

[ABC]

Matches “A”, “B”, or “C”

[L–P]

Matches “L”, “M”, “N”, “O”, or “P”

[0 – 9]

Matches “0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, or “9”

[^A – Z]

Matches any character that is not upper case

alphabetic

( )

Parentheses can be used in two different ways. They can be used in
search patterns to group characters and metacharacters to form
expressions. Parentheses must be used in pairs.

Examples

(AB)+

The plus sign applies to the expression (AB).

Strings that
would match this expression include: “AB”, “ABAB”, “123AB”,

and “AB123”.

Parentheses can also be used to identify strings for use in the Replace
Entire String With field. If a character, string, or expression is surrounded
by parentheses in a search pattern, then it can be later recalled in a
replace pattern with the “\n” metacharacter described elsewhere in this
chapter.

Note: Parentheses may be nested to form complex expressions.

Advertising