Validating Secondary Barcode Scans
This guide will help you understand how to validate secondary barcode scans and manual keyboard entries using regular expressions (Regex) and custom HTML scripts. With this approach, you can configure your app to capture only the data that meets your specific validation criteria.
Steps to Validate Secondary Barcode Scans
- Enable the Smart Scan Option:
- Use the Smart Scan feature in your service’s Advanced settings to configure barcode validation.
- Use Regular Expressions (Regex):
- Regex allows you to define patterns for acceptable barcode formats.
- Explore examples of Regex patterns in our Pattern Validation article.
- Apply Regex to Your Barcode Scanner:
- Input your chosen pattern to restrict barcode scanning to valid entries.

Validating Manual Keyboard Entries
You can also validate manually entered data or scanned input using an HTML script in a Custom Question. This setup works both online and offline, and coding skills are not necessary.
- Choose the Appropriate Script Version:
- Numeric Entry: For numbers only.
- Alphanumeric Entry: For a mix of letters and numbers.
- Edit the Regex Pattern in the Script:
- Update and Use the Script:
- Copy the updated HTML script and paste it into the Custom Question’s HTML form field in your app’s settings.
Once you know the regex pattern you want to use, find this in the HTML script:
// Regular expression for validating zip code format. var postalCodeRegExp = new RegExp("
^\\d{5}(-\\d{4})?$
");
Then, in a text editor like Notepad, replace the zip code regex ^\\d{5}(-\\d{4})?$ with your own regex pattern. For example, if you want to allow only 5 digits to be valid as a keyed entry or scanned entry, you would replace ^\\d{5}(-\\d{4})?$ with the regex pattern ^([0-9]{5})$. The result in the HTML script would then be:
// Regular expression for validating zip code format. var postalCodeRegExp = new RegExp("
^([0-9]{5})$
");
Copy and paste the HTML script into the Custom Question’s HTML form field.

Custom Validation for Developers
If you have coding expertise, you can create or modify your own scripts to meet advanced validation needs. This flexibility allows for tailored solutions that fit your exact requirements.
If you’re unsure which Regex pattern to use or need assistance setting up your validation process, our team is here to help. Contact us with your specific requirements, and we’ll guide you through the process.
By following these steps, you can effectively validate both barcode scans and manual entries, ensuring data accuracy and streamlining your workflows.