Rockwell Automation 5370-OCR2 PAK User Manual

Page 66

Advertising
background image

Chapter 6

Using Match Strings

6–4

Table 6.C
Search Pattern Metacharacters - Logical Operators and Other Special Functions

Character

Description and Use

[ ]

Square brackets ( [ ] ) match any single character enclosed within the brackets. 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 match any character which is not enclosed within the brackets.

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 match strings to group characters and metacharacters
to form expressions. Parentheses must be used in pairs.

Example

(AB)+

The plus sign applies to the expression (AB). Strings that

would match this expression include: “AB”, “ABAB”, and “ABABAB”.

Note: Parentheses may be nested to form complex expressions.

|

A vertical bar (the shifted “\” character on the keyboard) matches either the
character or expression on the left or right of the vertical bar. The vertical bar
should always appear within a set of parentheses.

Examples

(A | B)

Matches “A” or “B”

(abc|123) Matches “abc” or “123”

\

The backslash indicates that the following character, which would normally be
interpreted as a metacharacter, should instead be interpreted as a literal ASCII
character.

Example

\+

The plus ( + ) will be interpreted as a plus rather than as a
metacharacter.

Advertising