What is “REGEX” and how can that help solve my barcode scanning problems?
The capturing of bad barcode data is unfortunately quite common when scanning barcodes with iOS devices (iPhones, iPads, iPods); or Android smartphones and tablets; or when using USB/Bluetooth scanning accessories with PCs, Macs or Chromebooks; and even with purpose-built Android OS mobile computers (Honeywell, Zebra, etc.).
Bad data is very expensive in terms of lost time and productivity (recounts) and in terms of lost sales or angry customers from bad inventory data. The good news is that there are new barcode scanning technologies now available to help you quickly and accurately capture the right barcodes for your inventory audits.
Regular Expressions (“REGEX”)
According to Wikipedia, regex (a regular expression) is “a sequence of characters that define a search pattern. Usually this pattern is then used by string searching algorithms for “find” or “find and replace” operations on strings, or for input validation.”
Sounds complex but think of it like this – when you enter an email address online to register for a service, if the text you input (the “string”) doesn’t have an “@” symbol in it, the service will not allow you to register. That’s regex at work.
So, how does that technology help you with barcode scanning? Simple. On the codeREADr website you can configure the codeREADr mobile apps with regex, allowing your app-users to effortlessly capture just the right barcode data.
Select Barcode Type(s)
While this configuration option doesn’t involve regex, it is a building block for all of the regex technologies listed below so it deserves mention here. By limiting scans to one or more barcode types, your app-users will not be able to scan barcodes you don’t want them to capture. For example, you may want them to capture just an item’s UPC/EAN code and not the shelf label’s MSI code because your database was built using UPC/EAN codes.
Alter Scan Value
Sometimes the values embedded in the target barcode are not the same values you store in your database. If that’s the case, you can match those values with regex. For example, with UPC codes the check digit is in the barcode but what if it’s not in your inventory database? You can use regex to capture the barcode value but exclude the check digit, and thus you can validate it against your inventory database.
We sometimes call this technology “contextual” scanning because the codeREADr app will know which barcode to capture based on the filters and filter sets you pre-configure. We often use the IMEI on an iPhone box as an example because there are four code 128 barcodes and one UPC code in very close proximity. One of those code 128 barcodes is the IMEI barcode – so how can your app-users capture just that IMEI barcode quickly and accurately?
With Smart Scan you can configure a filter that will only capture code 128 barcodes but that won’t be enough because there are three other code 128 barcodes very close to the IMEI barcode. Since the IMEI (the device ID) begins with either “035” or “35”, a regex can be written to look for that pattern and only capture the barcode if it matches that pattern. To drill down even further with context, you could add to the filter that there had to be four code 128 barcodes and a UPC/EAN barcode in the camera view before applying the regex.
What if you also wanted to capture the UPC/EAN barcode? You could configure a Smart Scan filter to capture the UPC/EAN barcode as the primary scan and then configure an app-user prompt (a “Question”) with a Smart Scan filter to capture the IMEI code, both of which are included in the scan record.
If you have a database of your UPC/EAN values or SKUs, an excellent way to insure the right barcode is captured is validating every scanned value against that database. As an additional benefit, the app-user can see a description of the item (and optionally an image) for verification purposes before entering any other data associated with that scan (quantity, photo, etc). You can use regex when validating scans, too, if the scanned value needs to to be altered to match what’s in your database.
If you only have a partial database – or no database at all – you can use pattern validation instead. Here with regex you can force the scan to be valid only if it matches a defined regex pattern. If invalid (not in the database or non-matching) you can prompt the app-user to enter associated information to build a database or otherwise disposition the item in some other way.
Pattern Validation can also be used to disposition items out of warranty, discontinued or slated for a recall.
To keep you app-users from scanning the same barcode more than once, you can enable duplicate checking. Duplicates can be checked for a specific period – from one minute to a day or even forever for certain auditing tasks.
How is this valuable? It helps when your app users forget where they left off in the audit. Or, let’s say you have many people scanning for an audit. With duplicate checking, all app-users will know when an item has already been audited.
But what if you do have the same items in several locations? That’s no problem because you can create audit tasks (“Services”) for each location. In that way, duplicate checking is limited to the Service.
You can use regex to alert your app-users to certain conditions. For example, let’s say part of the auditing task is to separate discontinued items from inventory. When using regex to alter the scan or when using validation patterns, for the resulting scan record you can have a specific textual response. To emphasize certain conditions, you can use regex to find that text (the pattern) and, when it does, replace that simple text with an HTML-formatted response so the app-user cannot miss that message and any special instructions you may want to give them.
These are some of the valuable uses of regex to help you save time and money in your auditing tasks.