Skip to main content
Skip table of contents

125. Using Regexes With EzeScan

Regular Expressions (Regexes) may be used to manipulate captured data in EzeScan. For example - formatting dates; removing unwanted characters; replacing data with something else.

Regexes have some common anchors, character classes, quantifiers etc. Here are a few:


Identifies that there can be none, one or more of the preceding item
e.g. 0*1 can be used to find 01 or 0001 or 1.


identifies that there must be one or more of the preceding item
e.g. 0+1 can be used to find 01 or 0001 but not 1.


Is for the start of the search text, e.g. ^0* would find leading 0's
It can be used as a replacement regex to strip the leading zeros from 000012 to leave 12.


Is used to match any character
e.g ^.*[0-9]$ would find any numeric value or any value that ends with a numeric.


Is for the end of the search text
e.g. -$ would remove a trailing dash, e.g. 1234- would become 1234.


Is used to identify the start and end of a word
e.g. \b\d{2}\b would find 12 in 12 Years.


Is the OR separator this means we can look for multiple words
e.g a 2-digit word or a 3 digit word would be \b\d{2}\b|\b\d{3}\b


Is an escape character. It can be used to remove a character that is used in regex codes
e.g. to remove || at the end of a value you can't do ||$ you need to do \|\|$.

These are a few examples of Regexes commonly used within EzeScan:

TIP: The REGEXs in this section may be copied and pasted straight into the EzeScan REGEX editor. Drag your mouse across the values from the first " to the last "
for example "^0*(\d*)-(\d*)( - .*)","$1$2$3" The blue text represents the values to be replaced and the red text represents what the text is being replaced with the blue text.

  • Replace the 3rd and 6th character with a /
    This is handy if an OCR has picked up the / in a date as a 1 e.g. 12112112 will become 12/12/12
    Regex = "^(..).(..).","$1/$2/"

  • Keep the first value where it is delimited with two pipes (|)
    e.g. PO1234||0||1 will become P01234
    Regex = "^([^\|]+).*$","$1"

  • This will add a .00 if there is no decimal value. If there is a decimal value it will leave as is
    e.g. 100 will become 100.00 but 100.45 would remain as 100.45
    Regex = "(?!\s-?\d+\.\d+|^-?\d+\.\d+)(\s-?\d+\b|^-?\d+\b)","$1.00"

  • Clear out the whole value if it ends with a \
    e.g. "ezescan\" will become blank (null) whereas "ezescan" will remain as "ezescan"
    Regex = "^.*\\+$",""

  • Set a value to error if a numeric value has a minus
    e.g. 1 or 1.00 will be OK whereas -1 or -1.00 will change the value to error
    Regex = "-[0-9]+\.?[0-9]*","error"

  • Remove the first two characters out of a value
    e.g. "BA123456" will become "123456"
    Tip - add more dots to remove more characters

  • Convert a HP RM/TRIM KFI browse value to just output the first name and last name
    e.g. "Citizen, John (Mr) -lu 1660" will become "Jon Citizen"
    Regex = "-(lu [0-9]+)",""," *([(][^()]*[)])","","([^,]+),([^,]+)","$2$1","^ *",""

  • To remove the word VIC and any words after it
    e.g. "1 Smith St VIC" will become "1 Smith St"
    Regex = "^(.*)\sVIC\s.*$","$1"
    Note - Change the value VIC to NSW or QLD etc for other states

Suggested Regex Resources

If you are new to using Regexes we suggest you take a look at these resources on the internet.

    Regular Expressions Cheat Sheet by Dave Child - A quick reference guide for regular expressions (regex), including symbols, ranges, grouping, assertions and some sample patterns to get you started.

    Learn, Create, Understand, Test, Use and Save Regular Expressions with RegexBuddy
    You could buy a copy of RegexBuddy from the program's Authors.

    • Install and license it onto your PC where EzeScan is installed.

    • Start EzeScan & edit a KFI field → use one of our Regex Edit buttons to start up our 'Edit Regex' form. For example, the window below appears when working with a KFI Discovery field.

    • Then press the 'Editor' button (if it's grayed out tick the 'Use' button below it to enable it).

    • Ezescan will launch RegexBuddy if you have it installed on your PC.

    • Any regex entered into RegexBuddy will be automatically transferred to the corresponding regex field on the EzeScan Edit Regex form when you close RegexBuddy.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.