RegEx Examples

RegEx Examples

RegEx refers to a regular expression sequence of characters that specifies a pattern for the application to identify in the image. This section provides examples of common RegEx use cases and outlines the procedure to utilize them in Zebra Aurora.
All five codes were read without a filter.
Filter (\w) for all strings that include matches any word character (equivalent to [a-zA-Z0-9_])
Filter (\d) for all images that include at least one number.
Filter (\d0) to all numbers that are followed by zero.
Filter (\d1) to all numbers followed by the number one.
Filter (\d$) to every code with a number as its last digit.
Filter (^\d) to get any code with a number at the beginning.
Filter (\C) for a string that has the letter C.
Filter [DU] by a list. This example is the letter D or U.
Look for a specific string in the code (\USB)
Look for any data filter (\*)
Look for two specific prefix data filters (^78|^S2)
  • ^
    sets the anchor to the first char or string in the code
  • |
    is the logical OR
Look for a minimum code length (.{11})
  • .
    allows any sign
  • {11}
    is the number of signs needed for the result to be true. All orange codes are shorter than 11 signs.
Look for a code length range (^.{3,12}$)
  • “^” anchor at the start of the code
  • “$” anchor at end of the code
Specify the desired output by providing the information inside the brackets.
  • .
    allows any sign.
  • {3,12}
    the first number is the minimum number of signs needed to be true, and the second number represents the maximum
All codes with two or fewer signs are ignored, such as the TW on top of the PDF417 code. Codes with a length of 13 or more signs are also ignored.
Look for a code length range and an identifier (^78.{3,12}$
  • ^
    anchor at the start of the code.
  • $
    anchor at end of the code.
Specify the desired output by providing the information inside the brackets.
  • .
    allows any sign.
  • $78
    is the identifier needs to be at the beginning of the string.
  • {3,12}
    the first number is the minimum number of signs needed to be true, and the second number represents the maximum.
All codes with two or less signs are ignored such as the TW on top of the PDF417 code. Codes with a length of 13 or more signs are ignored as well.
Look for anything else, then look for a code length range and an identifier (^(?!^78.{3,12}$).) with inverse logic.
  • ^
    allows any sign.
  • $
    is the identifier needs to be at the beginning of the string.
Specify the desired output by providing the information inside the brackets.
  • .
    allows any sign.
  • 78
    is the identifier needs to be at the beginning of the string.
  • {3,12}
    the first number is the minimum number of signs needed to be true and the second number represents the maximum
Using the syntax ^(?!pattern). where the pattern is the pattern for negative pattern matching
Look for a numeric code with a length of 13 and starts with a 4 or a numeric code with a length of 20 that starts with a 0 (^4\d{12}|^0\d{19})
  • ^
    anchor at the start of code ^4 means the specific number 4 needs to be the first number in the code.
  • \d
    allows numbers only (0-9).
  • {12}
    number of signs needed to be true and the second number represents the maximum. It’s one less than the code length because the full string consists of the fixed first number + 12 numbers.
  • |
    is the logical OR
Find the serial number field of the FIS/MV Zebra Boxes (^S\d{13})
  • ^
  • \d
    allows numbers only (0-9).
  • {13}