Yang pattern does not accept valid Regex when it contains caret ^ or dollar $.
The bellow pattern is valid on Regex validators, but when run inside a Yang pattern template in an is-types.yang file my application errors.
However when i take off the ^ and $ from each part of the expression it works fine. However this now allows the regex to accept unwanted values.
I am trying to match either 1, 11, 1/1/1, 1/1/1/1.
Trying the pattern:
^([0-9]{1,3}/[0-9]{1,3}/[0-9]{1,3})$|^([0-9]{1,3}/[0-9]{1,3}/[0-9]{1,3}/[0-9]{1,3})$|^([0-9]{1,2})$
Yang typedef:
typedef interface_number_value {
type string {
pattern "([0-9]{1,3}/[0-9]{1,3}/[0-9]{1,3})|([0-9]{1,3}/[0-9]{1,3}/[0-9]{1,3}/[0-9]{1,3})|([0-9]{1,2})" {
error-message "error";
}
}
description
"description";
}
Also I am not sure where to raise issues/bugs with Yang.