RegEx with BarcodeInput component

I'm using the barcodeInput component with a Zebra Android scanner device. I want it to be able to take almost any input, so I made the RegEx

(.{3,26})$

When I do this, it sends the barcode in accumulating chunks. For example, if I scan TC84309463, I get TC8 first, then I get the whole barcode, perhaps because my minimum size is 3? I append an enter onto the end of the barcode, and when I see an Enter in the data, I know that the input is a full barcode and process it from there.

Is that how it is supposed to work? Perhaps my regex isn't quite correct? Any help appreciated.

Thanks

I tested your data in https://regex101.com/ and it works as you want.
I was going to suggest \r or \n or \r\n before the $ but it doesn't seem to be needed.

I was going to suggest it instead of $.

Apparently JS key event matching (or at least what we do in Perspective) doesn't work in a sane way, so you might need to match against the literal string Enter as your end-of-line character?

1 Like

I have found that I must look for the literal 'Enter' to determine that i have a full barcode.

My question is more - is this expected behavior? Should I expect multiple events before they full string is assembled?

I ask this to make sure my code is futureproof in case some timing changes somewhere, also it will relate to another question I will be asking once I know the answer to this. Thanks