How Regex Patterns are Used by DAM
"Regex" stands for "regular expression" (or sometimes "rational expression"). It is a syntax used to describe alphanumeric patterns in strings. It is often used in search engines to describe the pattern of characters being searched for.
The DAMVariants and DAMVariantSizes repositories define which variants are generated when specific image files are uploaded. If the pattern specified in their Regex Rule attribute matches the image's filename, the variant is generated.
Examples
If a certain variant's record in DAMVariants has a Regex Rule value of
_Install
and digital assets with the following filenames are
uploaded:
123_Install.jpg
A_test_Install.tif
Product12.png
the first two file names will match the regex pattern and the last one will not, therefore, DAM will generate the variants for:
123_Install.jpg
A_test_Install.tif
For a Regex Rule value of:
[0-9]*_merch_frt[0-9]*_[a-zA-Z]*
images with the filenames:
123_merch_frt_938984_ajklj.tif
9_merch_frt_0_z.eps
_merch_frt__.eps
match the pattern, therefore variants would be created for them. (An asterisk means zero or more of the preceding element, therefore, the last filename matches the pattern.)
Images with the following filenames would not match the pattern:
984_merch_bck_899_dog.tif
abc_merch_frt_90_aa.eps
182_merch_frt_983_983.jpg