Validation

boomxl provides many inbuilt validations that helps you to keep the data clean.

boomxl validation option is Array of Objects inside each column and each object represents the type of validation that needs to be applied on column mapped value, there may be multiple validation applied on single column, it will display errors if validation fails. There are some inbuilt validations and boomxl gives you option to define custom validations based on regular expression. Validation can be defined under "rule" key and if it contains regular expressions than it must be defined under "regex" key.

required

required is inbuilt validation that dislays error when a column contains empty value, it can be combined with other validations as well.

email

email is another inbuilt validation provided by boomxl, it will display error when column contains invalid email address. There is no need to define any regex for same.

Custom validations

You can define custom validations using regular expressions, just pass any custom name inside "rule" key that your user can easily identify and pass the regular expression inside "regex" key, Please donot use any regular expression flags like "i", "m" etc, it must be plain regular expression. Also escape special characters as mentioned in below table

Below is the table that represents sample of some regex code that you can use

Regex Code Description
/^\\d$/ Validates file column value is a single digit
/^\\w$/ Validates file column value is a single word
/./ Validates file column value can be any character
/\\s/ Validates file column value is a whitespace character
/^\\$\\w/ Validates file column value starts with $
/^[0-9]+$/ Validates file column value contains only digit
/^[0-9]{4}$/ Validates file column value contains only 4 digits
/^[a-zA-Z]+$/ Validates file column value contains only alphabets
/^[a-zA-Z ]+$/ Validates file column value contains only alphabets and spaces
/^[a-zA-Z]{4}$/ Validates file column value contains only 4 alphabets
/^\\d*\\.?\\d*$/ Validates file column value contains only numeric or decimal number
/^Start/ Validates file column value starts with Start
/End$/ Validates file column value ends with End
/^Start End$/ Validates file column value contains exactly Start End text
/ANY/ Validates file column value have ANY word in it
/ABC*/ Validates file column value have AB followed by zero or more C
/ABC+/ Validates file column value have AB followed by one or more C
/ABC?/ Validates file column value have AB followed by zero or one C
/A(B|C)/ Validates file column value has A followed by B or C
/^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$/ Validates file column value is in US phone number format
/^(?:(?:^|\\.)(?:2(?:5[0-5]|[0-4]\\d)|1?\\d?\\d)){4}$/ Validates file column value is a proper IP Address
/^\\d{5}(?:[-\\s]\\d{4})?$/ Validates file column value is a proper ZIP Code
/^(OPT1|OPT2|OPT3)$ Validates file column value is either OPT1 or OPT2 or OPT3

Combining validations

You can combine multiple validations on single column, pass multiple rules object inside "validation" object.

You can also combine pre-built validation like required or email with custom validation, below is the sample code snippet.

Configuration Normalization