Metacharacters – Rockwell Automation 5370-OCR2 PAK User Manual

Page 65

Advertising
background image

Chapter 6

Using Match Strings

6–3

The CVIM2 OCR package provides a complete set of special purpose
characters, called metacharacters, which you can use to construct match
strings. A metacharacter is used to match a sequence of one or more
characters which can vary from inspection to inspection.

A listing of valid metacharacters appears in the table below. Each appears
with a general explanation of its function and syntax. More detailed
examples of their use appear at the end of this chapter.

While the individual metacharacters perform easily understood actions,
combining and nesting them will quickly create extremely complex logical
expressions. Be sure to thoroughly test your expressions using the Test
Match
function, to make certain your match strings perform as you expect
them to under the conditions you are liable to experience.

Metacharacters can be entered with the keyboard or by selecting the
metacharacter buttons above the keyboard. The metacharacter buttons
include:

[A-Za-f]

Any alpha

[0-9] Any

number

?

0 or 1 occurrences of the preceding character

*

0 or more occurrences of the preceding character

+

1 or more occurrences of the preceding character

|

OR operation

Table 6.A
Search Pattern Metacharacters - Wildcard

Character

Description and Use

.

The period represents any single character, and is used as a single-character
“wildcard”.

Table 6.B
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 matches 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 matches 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 matches 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.

Metacharacters

Advertising