Develop content based barcode printing
Version number:


One must understand what is regular expression. The Regular Expression is a specific pattern that provides flexible means to "match" (specify and recognize) strings of text, such as words, particular characters or patterns of characters. Common abbreviations for "regular expression" include regex and regexp.

The location of the regexp.txt and regexpformat.txt sample files are:

On every system, the files are located in the directory pointed to by the %ALLUSERSPROFILE% environment variable.
The environment variable points to the “C:\Documents and Settings\All Users” directory on old systems, and to “C:\ProgramData\” on newer systems.

On old systems (Windows XP Windows Server 2003)
C:\Documents and Settings\All Users\Black Ice Software LLC\regexp.txt
C:\Documents and Settings\All Users\Black Ice Software LLC\regexpformat.txt

On new systems (Windows 8/7/Vista and Windows Server 2012/2008 R2/2008)
C:\ProgramData\Black Ice Software LLC\regexp.txt
C:\ProgramData\Black Ice Software LLC\regexpformat.txt

The file name and the location can be changed in the Printer Driver X1 INI file or by clicking the Options button next to the Extract Text (using Regular Expression parser). If the printer driver does not find the regexp.txt file, the Printer Driver X1 will extract the whole text from the printed document and uses the printed page text as the value of the barcode.

The regexp.txt should contain the regular expression to extract the data from the printed text. The regexpformat.txt contains the declared values to format the extracted data, by the regular expression, to be encoded into a barcode.

The Regular Expression Test sample

The Regular Expression Test utility included in the API – Resource Toolkit and can be downloaded through the website for free. The utility provides an easy solution for developers to test and write regular expressions for the content based barcode printing without using the Black Ice Printer Driver. The main advantage of this sample over the thousands downloadable regular expression test tools from the web is that the utility is using exactly the same ECMA script language as the Black Ice Printer Driver to ensure the developers that the regular expression will work properly in the Black Ice Printer Driver.

To test your regular expression print the document to the Black Ice Printer Driver with Extract text to File option checked under the File Formats tab. The Printer Driver will generate a text file contain the extracted text from the document into the Output folder.

Paste the extracted text into the Text area, the content from regexp.txt into the Regular Expression area and the content from regexpformat.txt into the Format area in Regular Expression Test sample. The Result area will automatically refresh where the user can see the result of the regular expression script.

.NET Framework 4.0

Download Black Ice Regular Expression Test utility

For more information about regular expression please see the following link;