Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 25 of 27

AdaptaScan Software (Cat. No. 2755-ASN) User Manual: C - Metacharacters

Pages 201 to 204 of 224, from AdaptaScan Software (Cat. No. 2755-ASN) User Manual

The original document is the PDF (2.8 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Accu-Sort 2755-SN3, Accu-Sort 2755-SN5, Allen-Bradley 2755-SN5, Accu-Sort 2755-SN8 and Allen-Bradley 2755-SN8

Page 201

Appendix C

Objectives

This appendix describes metacharacters and how they may be used in a match table rule, message find string, or replacement message.

Description

The Reader uses special characters to perform logical functions on characters, expressions, or even entire strings. These characters are known as metacharacters. Metacharacters are string manipulation commands consisting of standard ASCII characters embedded within search or replacement strings. Each metacharacter conveys a specific instruction to the Reader, and acts upon a clearly defined range within the string. There are two distinct sets of metacharacters. One set applies only to search strings and the other to replacement strings. If the Reader encounters a search string metacharacter in a replacement string, it will interpret it as a standard ASCII character. Conversely, if the decoder detects a replacement string metacharacter in a search string, it will interpret it as a standard ASCII character. For example, a “*” in a replacement string is treated as normal text but functions as a metacharacter in a search string.

Page 202

C–2

Metacharacters

Search Pattern Metacharacters

Use these metacharacters in the message find string or match table rule. They cannot be used in the message pass and fail replacement strings. Position Dependent Character

Description and Use Note: The following two metacharacters are position-dependent. They must appear in the location specified to be matched.

^

If the circumflex ( ^ ) is used as the first character in the find string, it indicates that the characters, other metacharacters, expressions, or strings must occur at the beginning of the string to be matched. Note that the circumflex has a special meaning if used within square brackets, as explained elsewhere in this chapter.

$

When the dollar sign is used as the last character in the find string, it indicates that the characters, other metacharacters, expressions or strings must occur at the end of the string to be matched.

Wildcard Character .

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

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. Use this metacharacter in a 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. Use this metacharacter in a 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. Use this metacharacter in a search string where the character may not appear, or may appear one or more times.

Page 203

Metacharacters

C–3

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 Pass/Fail Replacement String fields. 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. |

A vertical bar (the shifted “\” character on the keyboard) instructs the rule to match an incoming string if the character or expression on the left or right of the vertical bar appears in the string. 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 period ( . ) will be interpreted as a period rather than a single character wildcard.

Page 204

C–4

Metacharacters

Replacement String Metacharacters

Use these metacharcters in the message Pass/Fail replacement strings. They cannot be used in the message find string or match table rule. Replacement String Metacharacters Character

Description and Use

\n

The backslash plus a number 1 through 9 recalls a previously saved string. Any character, string or expression that is surrounded by parentheses in the Find String (as described in previous section) can be recalled by the replace pattern using the “\n” format. Since the parentheses may be nested, the number “n” represents the order of the groupings as defined by the order of the left parenthesis in the search pattern. Examples Find String = Pass/Fail Replacement String = Incoming String = Host Message =

123(ABC) \1 123ABC456 ABC

The Find String above matches the incoming string. The Pass/Fail Replacement String states that the string identified within the first parentheses should be sent to the host. Find String = Pass/Fail Replacement String = Incoming String = Host Message =

(123(ABC)) \1\2 123ABC456 123ABCABC

The Find String above matches the incoming string. The Pass/Fail Replacement String states that the string identified within the first parentheses (123ABC), plus the string identified by the second parentheses(ABC) should be sent to the host. &

When the ampersand ( & ) indicates that the part of the string that matches the Find String should be sent to the host. If the string contains more characters than the Find String, then the additional characters are discarded. Examples Find String = 123ABC Pass/Fail Replacement String = & Incoming String = 123ABC Host Message = 123ABC The Find String above matches the incoming string. The Pass/Fail Replacement String states that the string identified in the Find String should be sent to the host. Find String = 123ABC Pass/Fail Replacement String = & Incoming String = 123ABC456 Host Message = 123ABC The Find String above matches the incoming string. The Pass/Fail Replacement String states that the string identified in the Find String should be sent to the host. This does not include the digits 456.