# BarcodeScannerInput with Regex

**URL:** <https://forum.inductiveautomation.com/t/barcodescannerinput-with-regex/98051>\
**Category:** Ignition\
**Created:** [November 1, 2024, 4:43pm UTC](https://forum.inductiveautomation.com/t/barcodescannerinput-with-regex/98051 "2024-11-01T16:43:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joshua\_Jenkins](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@Joshua\_Jenkins](https://forum.inductiveautomation.com/u/Joshua_Jenkins)\
**Post date:** [November 1, 2024, 4:43pm UTC](https://forum.inductiveautomation.com/t/barcodescannerinput-with-regex/98051/1 "2024-11-01T16:43:09Z")

</div>

I'm working on setting up a BarcodeScannerInput that matches a regex.

/\b\d{6}-\d{3}(?:.\d{2})?(?:P\d{2}(?:.\d{2})?)?\b/g

my expression seems to match in regex101, but not getting a match in the barcode component.

i tried to simplify to

/\b\d{6}-\d{3}\b/g  
to capture "123456-001", but was also unsuccessful.

any advice?

---

<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:** [November 1, 2024, 5:55pm UTC](https://forum.inductiveautomation.com/t/barcodescannerinput-with-regex/98051/2 "2024-11-01T17:55:30Z")

</div>

make sure your `window` prop is large enough to capture the full length of the barcode.

Regex can get hairy quick, personally, I like this format better

```python
[0-9]{6}-[0-9]{3}

```

I've stopped using regex with this component. I stick to prefix/suffix framing and use a custom parsing class that attempts to parse the barcode against my precompiled regexes and returns the barcode type that was scanned along with the data it was parsed into.
