# Perspective Barcode Scanner Input: Bad Idea to use Regex on a Numeric Code?

**URL:** <https://forum.inductiveautomation.com/t/perspective-barcode-scanner-input-bad-idea-to-use-regex-on-a-numeric-code/63566>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [August 29, 2022, 2:48pm UTC](https://forum.inductiveautomation.com/t/perspective-barcode-scanner-input-bad-idea-to-use-regex-on-a-numeric-code/63566 "2022-08-29T14:48:19Z")\
**Posts on this page:** 1\
**Showing post:** 6

<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:** [August 29, 2022, 5:08pm UTC](https://forum.inductiveautomation.com/t/perspective-barcode-scanner-input-bad-idea-to-use-regex-on-a-numeric-code/63566/6 "2022-08-29T17:08:05Z")

</div>

I just tested it, and as I suspected, the buffer is not flushed once a regex is matched. This seems like a bug to me.

For example:

```auto
regex: ([0-9]{14})$
window: 14

```

2 barcodes, 1 correct, 1 random

```auto
Rando: 765756931175
Correct: 80157122001012

1. Scan random 1st
2. Scan correct barcode
3. Scan correct
4. Scan random

>> 76575693117580
>> 15712200101280
>> 15712200101276

```

It seems if you get off on a regex that does not have a well defined structure, you can’t get back to correct state.

Wouldn’t it make sense to flush the buffer once a regex match is found?

---

_[View the full topic](https://forum.inductiveautomation.com/t/perspective-barcode-scanner-input-bad-idea-to-use-regex-on-a-numeric-code/63566)._
