# Regex and barcode scanner help

**URL:** <https://forum.inductiveautomation.com/t/regex-and-barcode-scanner-help/64531>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [September 27, 2022, 1:58pm UTC](https://forum.inductiveautomation.com/t/regex-and-barcode-scanner-help/64531 "2022-09-27T13:58:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![apimente](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/apimente/32/4030_2.png) [@apimente](https://forum.inductiveautomation.com/u/apimente)\
**Post date:** [September 27, 2022, 1:58pm UTC](https://forum.inductiveautomation.com/t/regex-and-barcode-scanner-help/64531/1 "2022-09-27T13:58:45Z")

</div>

Hi Guys,

Please your help with some barcode scanner and the regex.

We need to read this kind of code:

**3100** 000000 **91** 10000150 **10** 2202255923

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](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/2/82c48007616e0f90cb9f34b9b6fbe6e451b7deb4.png)

Thanks in advance friends and best regards.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [September 27, 2022, 2:13pm UTC](https://forum.inductiveautomation.com/t/regex-and-barcode-scanner-help/64531/2 "2022-09-27T14:13:31Z")

</div>

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

```auto
(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](https://forum.inductiveautomation.com/t/perspective-barcode-scanner-input-bad-idea-to-use-regex-on-a-numeric-code/63566/6)

---

<div class="post-metadata">

**Author:** ![apimente](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/apimente/32/4030_2.png) [@apimente](https://forum.inductiveautomation.com/u/apimente)\
**Post date:** [September 27, 2022, 5:11pm UTC](https://forum.inductiveautomation.com/t/regex-and-barcode-scanner-help/64531/3 "2022-09-27T17:11:00Z")

</div>

> [@apimente](#):
>
> **3100** 000000 **91** 10000150 **10** 2202255923

YEEEESSSSS!!!!

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/5/458d66a8753bd1e9ac3b284900b64d35dbbad5c4.png)

Thank you very much
