module foo { yang-version 1; namespace "foo"; prefix "foo"; revision "2016-03-22" { description "test"; } container root { leaf my-leaf { type my-type; } } typedef my-type { type union { type string { pattern "dp[0-9]+o[0-9]+"; } type string { pattern "dp[0-9]+s[0-9]+(f[0-9]+)?(d[0-9]+)?"; } type string { pattern "dp[0-9]+(P[0-9]+)?p[0-9]{1,3}s[0-9]{1,3}(f[0-9]+)?(d[0-9]+)?"; } type string { pattern "dp[0-9]+p[0-9]+p[0-9]+"; } } } }