RegEx for Barcode Recognition

  • 34 Views
  • Last Post 2 weeks ago
Andre Dias posted this 3 weeks ago

Hi team,

we have two kinds of Barcodes that need to get recognized for a specific workflow: the barcode always starts with the year (2 digits), the letter K or T, and a consecutive number from 0001-9999 (always 4 digits). The second case is all the former but with the character A added at the end. A match would look like: 22K0001 or 22K0001A

To avoid any kind of problems with preapplied barcodes from external sources i would like to use a regular expression to only allow the workflow to continue, when it matches for my barcode.

Would that be the correct way to approach our usecase?

This is my regular expression: ([0-9]{2})(K|T)([0-9]{4})|([0-9]{2})(K|T)([0-9]{4}A)

Best regards,

Andre

Order By: Standard | Newest | Votes
luca.scarpati posted this 3 weeks ago

Hi Andre,

 

good choice the use of RegExp in your case wink.

Here you go an example: [0-9]{2}[K|T]{1}[0-9]{4}[A]*

...I didn't try it in the barcode module but I think it's structurally correct cool

 

Have a nice weekend.

 

Best regards,

Luca

  • Liked by
  • Andre Dias
Andre Dias posted this 3 weeks ago

Hi luca, thanks, i will try that out asap.

What exactly happens, when a barcode gets recognized that doesn't match? does it just get ignored or does the whole workflow stop when it finds a wrong barcode?

luca.scarpati posted this 3 weeks ago

Hi Andre,

 

More than welcome.

Simply ignored, in general if the recognized value is not matching the provided regular expression the result will be discarded and the barcode variable will return empty.

 

Best regards,

Luca

  • Liked by
  • Andre Dias
Andre Dias posted this 3 weeks ago

Hi luca, thanks once again.

So we use seperator pages with barcodes to do batch scans with the pages inbetween set to split the documents when they find a barcode. We had the problem that sometimes the document itself would include a random barcode from outside sources which would split the document too early.

Best regards,

Andre

luca.scarpati posted this 3 weeks ago

Hi Andre,

 

eheheh yes it could occur, if the barcode is of the same type as the "preselected" and if the RegExp result valid too.

...in this case maybe I suggest you to understand if the "separator" Barcode area is fixed, in that case maybe set a fixed area for it so as to narrow the margin of a potential wrong separation innocent.

 

Best regards,

Luca

  • Liked by
  • Andre Dias
Andre Dias posted this 3 weeks ago

Hi luca, just wanted to give an update on this.

Works like a charm and i hope that this will help others with similar problems.

Best regards,

Andre

  • Liked by
  • luca.scarpati
luca.scarpati posted this 2 weeks ago

Hi Andre,

 

great and happy that the suggested steps working.

Enjoy the weekend.

 

Best regards,

Luca

Close