Code formats (customer/vendor groups)

Field Code Format on the form of customer/vendor groups (tab General) allows for specifying rules according to which the code of customer/vendor added to a given group should be defined. If a customer/vendor group has a code format defined, then, on the basis of that code format, when adding a customer/vendor to the group, the system verifies the correctness of the code assigned to that customer/vendor by the user.

The code format is created according to the following rules of RegEx syntax:

  • First, is necessary to enter a special character which defines type and interval of characters uded in the code, e.g.
    • [] − indicating an element from a list
    • () − remembering the content in brackets as an item,
    • $ – meaning the end of a row
    • ^ – adjusting to the field beginning (a character following ^ must be the beginning of an expression)
  • Then, if the code is supposed to contain numbers, quantity quantifiers are used, e.g.:
    • \d − any number of digits
    • \d? − zero or one digit
    • \d − one digit
  • In order to use a white space (e.g., a space), it is necessary to add \s between expressions
  • The remaining characters are entered permanently into a code format (i.e., aa\d indicates that these codes can only be in the following forms: aa1, aa2, aa3, etc.)

Basic RegEx expressions:

Expressions Defining Possible Character Types

ExpressionMeaningNegation
[abcs23]Character from a list[^abcs]
[a-f]Character from a range[^a-f]
\dFigure\D
\wLetter of figure\W
\sWhite space character (space
character, enter, tab)
\S
.Any character

Expressions defining a number of repetitions of a given expression

ExpressionNumber of repetitions
*Zero or more
+ One or more
?Zero or one
{n}Precisely n
{n,m}From n to m
{n,}At least n

Exemplary use of RegEx Code Format:

Code formatExemplary Codes
\d{3}-\d{2}-\d{4}215-84-6377
\d*[a-z]{5}552345dress, lemon
\d{5}(-\d{4})? 33064, 33064-3597
\d{1,2} [A-Z]{3} \d{2}10 AUG 59, 5 JUL 99
\(\d{3}\)[A-Za-z]{3}-
\d{2}@\d{2}

(305)abc-45@55
\d{3}/\d{3}-\d{4}000/785-4555
((\d)|([1][0,1])):[0-5]\d[A,P]M5:30PM, 10:05AM
\d{1,2}’ \d{1,2}’’ 5' 6", 12’ 11’’
4\d\w{3}-\d41G1A-2, 42222-2, 41aaa-2
aaa[1-4]?\daaa1, aaa21, aaa49, aaa40

A code format can be also a part of a configuration tool, however, in such case, the following expressions are not handled:

  • expressions containing special characters:
  • \d
  • \w
  • \s
  • *
  • +
  • {n,}

 

Czy ten artykuł był pomocny?