Barcode regex

The barcode regex feature enables the user to define Inspection and Route barcode identifiers that can match multiple non-identical barcode strings.

Regular expressions (regex) are characters sequences that specify match patterns in strings. By using a regex as Inspection/Route barcode identifier, the user defines the characteristics a barcode string must have in order to match the Inspection/Route identifier.
In this way, a barcode scan can trigger a match between the barcode string and the Route/Inspection identifier even if the two strings are non-identical, making possible to link the same Inspection/Route to a group of barcode strings that share the specified characteristics.

The barcode regex identifiers must use regex syntax compatible with Java 8. For more information, refer to Validating a barcode regex identifier.

The following table shows some examples of basic string characteristics and the regex constructs to use in order to match them:

The string must include

Regex

A single digit

[0-9]

A single letter

[A-z]

A single uppercase letter

[A-Z]

A single lowercase letter

[a-z]

Two letters

[A-z]{2}

A single digit between 3-6

[3-6]

A single letter between C-M

[C-M]

Any value (zero or multiple times)

.*

Any value (three times)

.3

A whitespace

\s

Text containing A or B

(A|B)

Text containing A and B

(?=.*(A))(?=.*(B))

Text starting with ABC

^ABC

Text ending with ABC

ABC$

The following table shows some scenario examples and their matching regex constructs:

#

Scenario

Regex

1

In position 1-2-3 there are digits

^[0-9]{3}

2

In position 4-5-6 there are letters

^.{3}[A-z]{3}

3

Exact value of position 7-8 is ER

^.{6}(ER)

4

In position 9-10 there is a number between 10 and 49

^.{8}[1-4][0-9]

5

In position 9-10 there is a number between 10 and 50

^.{8}([1-4][0-9]|50)

6

In position 9-10 there are letters between CA and LZ

^.{8}[C-L][A-Z]

7

The text contains XYZ

XYZ

8

The text contains 12 and AB independently from the order

(?=.*(12))(?=.*(AB))

9

Scenarios #1 #2 #3 #4 at same time

^[0-9]{3}[A-z]{3}(ER)[1-4][0-9]

10

Scenarios #1 #2 #3 #4 #7 at same time

(?=.*([0-9]{3}[A-z]{3}(ER)[1-4][0-9]))(?=.*(XYZ))

11

Scenarios #1 #3 #6 at same time

^[0-9]{3}.{3}(ER)[C-L][A-Z]

12

In position 1-2-3 there are letters, followed by a dot, then a letter, a whitespace and ends with a number

^[A-z]{3}[.][A-z]\s.*[0-9]$