The backslash \ symbol in <regex> definitions inside XML templates will be ignored during comparison, this makes unusable any regex which contains it, like:
\d \b \w \\
The problem exists because all regex are converting into node.def as-is. And later, configuration parser considers \ as an escape symbol. So, we need to add escaping of \ before saving it to node.def.
Example:
XML: <regex>^\d\w123$</regex>
node.def: syntax:expression: exec "${vyos_libexec_dir}/validate-value.py --regex \'^\d\w123$\' --value \'$VAR(@)\'"; "Invalid value"
Scripts arguments: ['/usr/libexec/vyos/validate-value.py', '--regex', '^dw123$', '--value', 'test']