00197195-02-UG SetupCenter 5.1_en - 第91页

Barcode Regular Expression - Basics Barcode Labe ls User Guide SIPLACE Setup Center 5.1 91 This is then followed by the definition "(?<OriginalQuantity>[0 -9]{5,8})" of the pac kaging un it original quant…

100%1 / 196
Barcode
Barcode Labels Regular Expression - Basics
90 User Guide SIPLACE Setup Center 5.1
5.1.4 Regular Expression - Basics
To process the contents of scanned barcodes, you need to create comparative templates, which are
stored in the system as barcode patterns. These serve as a reference against which scanned barcodes
are compared, to decide whether they are correct or incorrect.
Regular expressions are used to define barcode patterns. They describe the barcode information and
subdivide it into individual fragments, with the help of pattern matching.
5.1.4.1 Barcode Pattern
The barcode pattern enables the user to formally describe the content of a scanned-in barcode. The bar-
code pattern consists of the individual patterns for a barcode fragment. It defines:
1. The part of the barcode which is assigned to a certain barcode fragment type e.g. the component,
unique barcode or the original quantity of the packaging unit.
2. The format of the barcode fragment contents.
3. The order in which the sections for the barcode fragments appear in the barcode.
The so-called pattern matching plays a decisive role in the processing of scanned-in barcode contents.
The question is how to describe the required text passages of a decoded barcode. If the text passage is
already exactly known, it can be directly entered during the search. This search function is identical with
that from all other editors.
However, this is not the most flexible of options. For example, if you want to determine the original quan-
tity of the packaging unit from the barcode and then discover that this consists only of a string of num-
bers, you are faced with a problem. This type of designator can not be adequately described by writing
it down or by listing the various options. This is where so-called "Regular Expressions" can help.
Regular expressions serve to describe the format of a barcode. They are a syntactic utility for the de-
scription of a character string. An example of a barcode, from which the original quantity of a packaging
unit, with the prefix ‚Q', is to be extracted, can be seen below:
^(?<Ignore>Q.{0,0})(?<OriginalQuantity>[0-9]{5,8})$
Let's go through it step by step. We first see the character"^'" which means that the barcode begins here.
It is vital that this character is positioned here, otherwise any number of other characters could be placed
before the string described below and the barcode would still be recognized.
We then see the definition for the barcode fragment "(?<Ignore>Q)". The fragment type "Ignore" means
that the content is not to be stored in the database but that this string of characters appears frequently
in the barcode, as a prefix or postfix. In this case, the character "Q" would always be expected before
the original quantity and, if the character "Q" was missing, the scan would terminate with errors.
Open the Extras => Settings =>Barcode labels menu.
Scan the barcode to be checked and the scanned
barcode will be entered in the Scanned barcode input
field (3).
Select the relevant barcode label at Label name (1).
Open the context menu and select the Match (2)
function. The scanned barcode is matched with the
settings of the corresponding barcode label.
⇨ The dialog box showing the Barcode matching re-
sults is opened and the results are displayed.
Barcode
Regular Expression - Basics Barcode Labels
User Guide SIPLACE Setup Center 5.1 91
This is then followed by the definition "(?<OriginalQuantity>[0-9]{5,8})" of the packaging unit original
quantity. In this case, the fragment type is "OriginalQuantity", which corresponds to the starting quantity.
The format definition "[0-9]{5,8}"' restricts the character class to the numbers "0" to "9", which ensures
that the original quantity can only be a positive amount. The length "{5.8}" specifies the minimum (5) and
maximum (8) amount of numbers which may be used to define the original quantity.
Lastly, we see the symbol "$", which means that the barcode ends here. It is vital that this character is
positioned here, otherwise any number of other characters could be placed after the string described
above and the barcode would still be recognized.
Please note that a barcode fragment always has the syntax "(?<FragmentType>.{n,m})". The "." in this
syntax can be replaced by other characters or special characters. The characters 'n' and 'm' are always
numbers, which represent the minimum (n) and maximum (m) amount of the pattern located before
them. Furthermore, a barcode should always be framed by "^...$", to clearly indicate where it begins and
ends.
Regular Expression Syntax
Regular expressions are used to define barcode patterns. They describe the barcode text and subdivide
it into individual fragments, with the help of pattern matching.
Individual Characters and Character Classes
The regular expression consists of a character string. Each character in this string stands for itself, un-
less it is one of the special characters +?.*^$()[{|\. The special meaning of these characters can be
canceled by placing a \ before the character concerned e.g. \? or \\.
NOTICE
Extra1, Extra2, Extra3
A barcode label should define a barcode fragment for all parts of a scanned-in barcode.
If the content does not correspond to any predefined fragment type, the fragment types
'Extra1’, 'Extra2’ or 'Extra3' should be used. If you are absolutely sure that a string of char-
acters can be rejected and will not be required again, assign the fragment type ‚Ignore' to
that string.
NOTICE
Diagram of a Barcode Label
The "Barcode label detailed" view can not graphically display all types of a particular bar-
code pattern. For example, the graphic representation of the length may differ from the
sample length defined in the barcode pattern. It may also not be possible to show some
highly complex barcode patterns as a graphic.
Character class Description
. Recognizes any character.
[aeiou] Recognizes each individual character, summarized to form a class of characters
to be recognized.
[^aeiou] Recognizes each individual character which is not in the class of characters.
[0-9a-fA-F] The hyphen allows you to describe a string of connected characters.
\w Recognizes each alphanumeric symbol and an underscore. \w has the same
meaning as [a-zA-Z_0-9].
\W Recognizes each non-alphanumeric symbol and an underscore. \W has the same
meaning as [^a-zA-Z_0-9].
\s Recognizes each whitespace character. \s has the same meaning as [ \f\n\r\t\v].
Barcode
Barcode Labels Importing and Exporting Barcode Labels
92 User Guide SIPLACE Setup Center 5.1
Quantifiers
Quantifiers use individual characters or character classes as often as possible. If this pattern is followed
by ?, the minimum amount will be recognized. The following quantifiers are available:
Anchors, Groupings and Alternatives
Character classes and quantifiers are only a few of the many special characters. The following table ex-
plains the main special characters for barcode patterns: anchors, groups and alternatives.
5.1.5 Importing and Exporting Barcode Labels
Starting with version 3.0, you can import barcode labels from an ApplicationSettings.xml file and export
barcode labels via an ApplicationSettings.xml file.
All labels of the file are imported. It is not possible to add any labels!
This function is useful when the barcode labels need to be transferred from one Setup Center to another
within the same production process.
\S Recognizes each non-whitespace character. \s has the same meaning as [^
\f\n\r\t\v].
\d Recognizes each number. \d has the same meaning as [0-9].
\D Recognizes any sign apart from numbers. \P has the same meaning as [^0-9].
Qualifier Description
* Recognizes the preceding sample element multiple times or not at all e.g. \w* or
(abc)*. Corresponds to {0,}.
+ Recognizes the sample element located before this once or multiple times e.g. \w+
or (abc)+. Corresponds to {1,}.
? Recognizes an element once or not at all e.g. \w? or (abc)?. Corresponds to {0.1,}.
{n} Gives the exact number of hits e.g. p{2}.
{n,} Gives the minimum number of hits e.g. p{2,}.
{n,m} Gives the minimum (n) and maximum (m) number of hits e.g. p{2,3}.
*? Recognizes the sample element but recognizes as few characters/repeats as pos-
sible.
+? Recognizes the sample element at least once but then recognizes as few charac-
ters/repeats as possible.
{n,}? Recognizes the sample element at least "n" times but then recognizes as few char-
acters/repeats as possible.
{n,m}? Recognizes the sample element at least "n" times but then recognizes as few char-
acters/repeats as possible and to a maximum of "m" times.
Qualifier Description
^ Ensures that the following pattern is recognized at the beginning of a character
string, e.g. ^a
$ Ensures that the preceding pattern is recognized at the end of a character string,
e.g. z$
( … ) Groups a number of pattern elements into a single element e.g. (pizza)
… | … | … Recognizes from left to right the first indicated alternative e.g. (a|b|c)
Character class Description