Hello
The isMatch() function requires two parameters: the string to check and the regex string. Based on your requirements, here are the patterns you need:
Germany "DE" + 20 digits '^DE\d{20}$'
United Kingdom "GB" + 2 digits + 4 letters + 14 digits '^GB\d{2}[A-Z]{4}\d{14}$'
I would have 2 attributes in a configuration entity one for the regex pattern and one for the country name.
IN the flow logic I would retrieve the correct validation configuration based on the country I need to validate currently and apply the isMatch() function and pass these attributes and perform the validation this way.
or maybe have 2 entities, one for validation configuration and one for country and properly associate each other
Hope this helps!