Skip to main content

ProGlove Documentation

Regular Expressions

Regular Expressions (Regex) are used for barcode data manipulation.

With Regex, complicated string matching and character replacement on barcode data is enabled.

The Matches condition tries to compare a Regex with the incoming barcode data. The rule execution only continues if the Regex matches the text.

The Replace with Regex action replaces or deletes a character. Firstly, a Regex is compared with the barcode string, the Match field. Then, the replacement data is applied.

Intro to Regex

Regex can contain special characters and normal letters. To learn more, see RegexOne.

Regex are created by combining different elements together:

  • Characters, numbers, etc. can be written as such: a0 but also (space)

  • Regex are case-sensitive

  • If you want to match special characters like (),. etc., escape them using \, \(, or \.

  • If you want to find a character, use . (the wildcard)

  • If you want to match a Unicode or ASCI special character, use \xHEX_CODE

  • You can specify the number of occurrences of a character:

    • ? for zero or one occurrence of that character

    • * for 0 or more occurrences of that character

    • + for 1 or more occurrence of that character

    • {minimum,maximum} for a specific number of occurrences

  • If a set of characters is valid, it can be put into a [] and modified together. For example: [0-9]{3,5} will match all numbers (from 0-9) between 3 and 5 times

  • Important special characters are ^ and $ - they refer to the start of the string (^) and the end ($) of the string. This allows you to define that the full string is matched.


Regex are very exact. If the punctuation or the capitalization is wrong, the string will not match.

Replace with Regex

To replace content with Regex, the best practice is to use the group feature.

Wrap a part of the Regex in () to define a group.

You can then reference these groups in the Data field as $1 for the first group, $2 for the second, and so on.

Test your Regex

To avoid common mistakes when writing Regex, we recommend you use Regex101 and try it out before you input them in Insight Webportal.

Enter samples of your target data into the Test Data field (each in a new line).

Then, enter the Regex into the Regular Expression line at the top. The tool will automatically highlight the matched text and explain the Regex on the side.

If you want to test replacing, unfold the Substitution part and enter the replacement rule in this field.

Regex examples
Numeric barcode prefixed with B

Regex: B[0-9]+


  • B1

  • B345678

  • B3596789491


  • :B1 23

Doesn`t match:

  • B 123 (has a space in between)

Numeric barcode prefixed with B - Better

Regex: ^B[0-9]+$

Explanation: A B as the first character of the barcode, followed by one or more numbers until the end of the string.


  • B1

  • B345678

  • B3596789491

Doesn`t match:

  • B 123 (has a space in between)

  • AB1DEYFN (doesn’t start with a B)

  • B1 23 (has extra characters in there)

Cut after 10 digits

Regex (Match): ^([0-9]{10,10}).*

Replacement (Data): $1

Explanation: Matches a barcode that starts with 10 numbers and anything afterwards and replaces with those ten numbers (deleting the rest).


  • 123456789012335467’ -> replaces with 1234567890

  • 1234567890’ -> replaces with 1234567890

  • 1234567890 daosn’ -> replaces with 1234567890

Doesn`t match:

  • ‘12345’

  • B’1234567890’ (doesn’t start with a number)

  • B1 23 (has extra characters in there)

Reverse Order

Regex (Match): ([0-9]+)-([a-z0-9]+) Replacement (Data): $2;$1

Explanation: Matches a barcode with some numbers (any length) followed by a ‘-’ followed by an arbitrary length or numbers and (lowercase) characters.


  • 1234-ated1234daosn’ -> replaces with ‘ated1234daosn;1234’

  • 1234-ated1234 popasmd’ -> replaces with ‘ated1234;1234’