Attribute Data Validation in PIM
The Product Information Management System (PIM) employs data masks that adhere to the PCRE2 (Perl Compatible Regular Expressions) standard to ensure data validation and conformity to predefined criteria. These regular expressions provide a powerful tool for matching and manipulating text patterns in the product data, thereby guaranteeing that the data entered adheres to the established specifications. This ensures the accuracy, consistency, and quality of the product data across the system. These masks can be defined for any attribute that supports data validation masks. When creating or editing an attribute the PRCRE2 validation masks goes in the "mask" field.
For instance, a PIM could use a PCRE2 regular expression to validate the format of a product's UPC number, ensuring it always follows the same pattern. UPC (Universal Product Code) codes follow a standard format. A UPC code is a 12-digit number that uniquely identifies a product. The code is divided into different sections, each carrying specific information about the product.
Data validation masks help to ensure that data like UPC codes are entered into the system correctly and adhere to the correct format. In this case it involves ensuring the data entered is a 12-digit number that follows the standardized UPC structure.
A simple regular expression for a valid 12-digit UPC code would be: ^[0-9]{12}$
This expression can be broken down as follows:
The ^ symbol denotes the beginning of the line.
[0-9] represents any digit from 0 through 9.
{12} specifies that the preceding element (any digit) must occur exactly 12 times.
The $ symbol denotes the end of the line.
So, ^[0-9]{12}$ matches any string that consists exactly of 12 digits, which is the standard for UPC codes.
This expression does not verify the check digit, which is calculated with a specific formula from the first 11 digits. To incorporate check digit validation, you would need a more complex regular expression and additional computational logic to calculate and compare the check digit.
For more information on Data Validation please see the help topic: Data Validation Masks