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:
regex: ([0-9]{14})$
window: 14
2 barcodes, 1 correct, 1 random
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?