The reason is that the YANG module you are using uses non-compliant regular expression. YANG RFC requires use of XML-Schema regular expressions, whereas the module - I assume it is openconfig-yang-types - uses POSIX regular expressions. One notable differences between the two standards is in the use of
"$" characters - in POSIX they serve as anchors, denoting the start and end of the match, in XML-schema they are just plain characters as expressions are anchored implicitly. In other words, the regular expression you pasted means something different as a POSIX regex - an anchored datetime string; and something different as YANG-standard XML-Schema regex - a datetime string delimited by
This is unfortunately just one of many issues with OpenConfig YANG modules. If you need to stick with OpenConfig, this particular issue is still relatively easy to deal with. One option is to just modify the module before compilation, and depending on how you integrate with other components, this may be good enough. Other options is to use already existing compile-time
yanger plugin that fixes exactly this problem; the plugin will be part of the confd-7.4 release.
But again, you may expect other problems if you use OpenConfig modules.