Regular expressions in pattern not working as expected

I am using the regex ^[][^0-9,A-F#*.?+%()-]*T?($)?$ in pattern

pattern’^[][^0-9,A-F#*.?+%()-]*T?($)?$’;

But when I am giving string “3456” , it is not accepting. This is a valid regular expression as checked online.

This is known issue in openconfig Yang models, which uses non-standard string pattern regular expressions. See https://github.com/openconfig/public/issues/175 for details. It is not clear for how long it is going to take for Google to fix the models, it might not happen at all. Therefore, please use Cisco native models in your application. Another option would be download openconfig models to some directory, manually fix all the pattern definitions and then either use the directory as repository or copy conflicting files to the device repository.

Also, YANG RFC states that W3C Regexs should be used which are diferent from Posix Regexs that OpenConfig modules contain.

Some useful links:

The “pattern” statement:

https://tools.ietf.org/html/rfc7950#page-148

Link to the W3C recommendation for Regexs:

https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#regexs

ygorelik gave some good solutions to this in the mean time.