Regex and barcode scanner help

Hi Guys,

Please your help with some barcode scanner and the regex.

We need to read this kind of code:

31000000009110000150102202255923

The 3100 is the prefix but we don’t have a suffix, so i think we need some regex and despite i have some progress, i can’t get what i want.

The only things that we have for the regex are the initial **3100 and the lenght of the string.

We need that the barcode scanner from perspective read the string as one data (not every char in the data array). Like this:
image

Thanks in advance friends and best regards.

A couple of things you could do.

  1. Most scanners can add a suffix to the barcode without it actually being apart of the barcode like a tab, line feed, carriage return, or any other character. Just program the scanner to add a suffix of your choice

  2. If you do use regex, it would be something like this

(3100[0-9]{28})$

The barcode must start with 3100, then must have 28 digits matching 0-9.

Note: I found that regex with the barcode scanner component to be flawed.
Perspective Barcode Scanner Input: Bad Idea to use Regex on a Numeric Code? - Ignition - Inductive Automation Forum

4 Likes

YEEEESSSSS!!!!

Thank you very much

1 Like