Regex Pattern Implementation


I need a regex pattern that has to match a string that is not strictly numbers, doesn’t have a space and ‘?’ character. How do I perform the inverted match?

Thank you

In a YANG 1.1 module, you can use the modifier substatement to pattern, see, to invert the match.

Thank you, will look into it.

Is there a way of doing this in YANG version 1.0?

There is no “direct” way to do an inverted match, the modifier statement was added in 1.1. But at least for some regexps, you can produce another regexp that requires the inverse of the original one. There is no universal method for this as far as I know, and the “inverted” expression can become quite complex. So why not use YANG 1.1? For most modules, it’s just a matter of adding the yang-version 1.1; statement.