Page tree
Skip to end of metadata
Go to start of metadata

The CartonCloud Mobile App can scan standard format product barcodes by default however you may wish to scan a custom format. Eg. GS-1 labels containing not only the product barcode but also additional information (batch numbers, expiry dates, etc.). To achieve this, Regular Expressions can be defined on a per-customer basis to enable the extraction of product barcodes. 


To learn more about Regular Expressions, use https://regex101.com/ which allows you to create and test your own Regular Expressions against real data.


Setting Up Regular Expressions For Customer Barcodes

To define the Regular Expressions, navigate to Customers, select the Customer that you wish to set a custom format for, click Edit and navigate to the Barcode tab.



Within the Regex text field you are able to define one or more Regular Expressions to extract barcode content. These expressions have to be contained inside a JSON format array. Eg. ["regular expression 1", "regular expression 2"]


To learn more about JSON visit https://www.w3schools.com/js/js_json_intro.asp


When trying to extract product barcodes from a scanned input within the mobile app, the app will first attempt to match the complete input to a standard format. If this fails then it will work through the custom Regular Expressions until it finds a match. It will process the custom expressions from first to last. If no match is found then a message will be displayed in the mobile app informing the user of this.

Regular Expression Examples


Regular Expression example
["01([0-9]*)15[0-9]{6}","01([0-9]*)15[0-9]{6}10[0-9]*","01([0-9]*)15[0-9]{6}[0-9]*","01([0-9]{14})[0-9]*"]


InputRegular ExpressionResult
0112345671234567150101172012301([0-9]*)15[0-9]{6}No Match
0112345671234567150101172012301([0-9]*)15[0-9]{6}10[0-9]*No Match
0112345671234567150101172012301([0-9]*)15[0-9]{6}[0-9]*Match - Extract Barcode: 12345671234567
0112345671234567150101172012301([0-9]{14})[0-9]*Skipped because match found previously


We recommend testing your regex before implementing at: www.regex101.com





  • No labels