Repository: openconfig/ygot
Pull request #434 (2020-08-17 06:27:07)

Add oc-ext:posix-pattern Support
- Use `yang.YangType.POSIXPattern` instead of `yang.YangType.Pattern` whenever the former exists.
- `CompilePOSIX` is used for `oc-ext:posix-pattern`, and `Compile` is used for `pattern` for backwards compatibility. (e.g. inet-ipv4address fails to compile with `CompilePOSIX` due to `\p` -- it seems there is some of the same character class support in the regular `regexp.Compile` function).
- fix corner case bug in `fixYangRegexp` and move to util package.

github-actions[bot]: 
[![Coverage Status](https://coveralls.io/builds/32793700/badge)](https://coveralls.io/builds/32793700)

Coverage increased (+0.02%) to 90.749% when pulling **29c238ea8e27bcdf409cb7044a53b4d94f8c5c51 on posix-pattern** into **b9d3c8fbd806ad01181ce6608af8e62fef66d208 on master**.

wenovus: The OC models have already moved over actually. I'll add some tests.
wenovus: Oh I see, we haven't yet updated the public models repository.

How should the integration test be done when both regexes exist?

The regex integration test fix I made is on a test which was passing only because a different error (i.e. key mismatch) was occurring, and not because of a regex error.
wenovus: @robshakir You can disregard my previous comments.
Is this good to submit given that now,
- There is a working integration test on a regex here: ytypes/schema_tests/validate_test.go
- I have added a new unit test for both POSIX and non-POSIX that fails due to string going past anchors.
- The edge case has been explained.
wenovus: Since I believe the comments have been addressed and approval has already been given, I will submit this.

Patch:
diff --git a/go.mod b/go.mod
index 0b0b70f..f23590f 100644
--- a/go.mod
+++ b/go.mod
@@ -8,7 +8,7 @@ require (
 	github.com/google/go-cmp v0.4.1
 	github.com/kylelemons/godebug v1.1.0
 	github.com/openconfig/gnmi v0.0.0-20200508230933-d19cebf5e7be
-	github.com/openconfig/goyang v0.0.0-20200616001533-c0659aea65dd
+	github.com/openconfig/goyang v0.0.0-20200803193518-78bac27bdff1
 	github.com/pmezard/go-difflib v1.0.0
 	golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 // indirect
 	golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 // indirect
diff --git a/go.sum b/go.sum
index 4256bc3..25583bf 100644
--- a/go.sum
+++ b/go.sum
@@ -39,8 +39,8 @@ github.com/openconfig/gnmi v0.0.0-20200414194230-1597cc0f2600/go.mod h1:M/EcuapN
 github.com/openconfig/gnmi v0.0.0-20200508230933-d19cebf5e7be h1:VEK8utxoyZu/hkpjLxvuBmK5yW3NmBo/v/Wu5VQAJVs=
 github.com/openconfig/gnmi v0.0.0-20200508230933-d19cebf5e7be/go.mod h1:M/EcuapNQgvzxo1DDXHK4tx3QpYM/uG4l591v33jG2A=
 github.com/openconfig/goyang v0.0.0-20200115183954-d0a48929f0ea/go.mod h1:dhXaV0JgHJzdrHi2l+w0fZrwArtXL7jEFoiqLEdmkvU=
-github.com/openconfig/goyang v0.0.0-20200616001533-c0659aea65dd h1:tADOCjwReJpTRMXVGQn1LpGaX7zU5nqr4LalWOS9Wts=
-github.com/openconfig/goyang v0.0.0-20200616001533-c0659aea65dd/go.mod h1:vX61x01Q46AzbZUzG617vWqh/cB+aisc+RrNkXRd3W8=
+github.com/openconfig/goyang v0.0.0-20200803193518-78bac27bdff1 h1:qWqJWq75QvJcn/RJJraNgBOzgzqL7FXgeqChxOBH6MU=
+github.com/openconfig/goyang v0.0.0-20200803193518-78bac27bdff1/go.mod h1:vX61x01Q46AzbZUzG617vWqh/cB+aisc+RrNkXRd3W8=
 github.com/openconfig/ygot v0.6.0/go.mod h1:o30svNf7O0xK+R35tlx95odkDmZWS9JyWWQSmIhqwAs=
 github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3 h1:YtFkrqsMEj7YqpIhRteVxJxCeC3jJBieuLr0d4C4rSA=
 github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
diff --git a/util/debug.go b/util/debug.go
index 225468e..ee4c9e4 100644
--- a/util/debug.go
+++ b/util/debug.go
@@ -178,8 +178,8 @@ func SchemaTypeStr(schema *yang.Entry) string {
 // YangTypeToDebugString returns a debug string representation of a YangType.
 func YangTypeToDebugString(yt *yang.YangType) string {
 	out := fmt.Sprintf("(TypeKind: %s", yang.TypeKindToName[yt.Kind])
-	if len(yt.Pattern) != 0 {
-		out += fmt.Sprintf(", Pattern: %s", strings.Join(yt.Pattern, " or "))
+	if p, isPOSIX := SanitizedPattern(yt); len(p) != 0 {
+		out += fmt.Sprintf(", Sanitized pattern (POSIX: %v): %s", isPOSIX, strings.Join(p, " or "))
 	}
 	if len(yt.Range) != 0 {
 		out += fmt.Sprintf(", Range: %s", yt.Range.String())
diff --git a/util/yang.go b/util/yang.go
index 93132c5..0dbd55f 100644
--- a/util/yang.go
+++ b/util/yang.go
@@ -16,6 +16,7 @@
 package util
 
 import (
+	"bytes"
 	"fmt"
 	"reflect"
 	"strings"
@@ -221,6 +222,83 @@ func IsYANGBaseType(t *yang.YangType) bool {
 	return ok
 }
 
+// SanitizedPattern returns the values of the posix-pattern extension
+// statements for the YangType. If it's empty, then it returns the values from
+// the pattern statements with anchors attached (if missing).
+// It also returns whether the patterns are POSIX.
+func SanitizedPattern(t *yang.YangType) ([]string, bool) {
+	if len(t.POSIXPattern) != 0 {
+		return t.POSIXPattern, true
+	}
+	var pat []string
+	for _, p := range t.Pattern {
+		// fixYangRegexp adds ^(...)$ around the pattern - the result is
+		// equivalent to a full match of whole string.
+		pat = append(pat, fixYangRegexp(p))
+	}
+	return pat, false
+}
+
+// fixYangRegexp takes a pattern regular expression from a YANG module and
+// returns it into a format which can be used by the Go regular expression
+// library. YANG uses a W3C standard that is defined to be implicitly anchored
+// at the head or tail of the expression. See
+// https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#regexs for details.
+func fixYangRegexp(pattern string) string {
+	var buf bytes.Buffer
+	var inEscape bool
+	var prevChar rune
+	addParens := false
+
+	for i, ch := range pattern {
+		if i == 0 && ch != '^' {
+			buf.WriteRune('^')
+			// Add parens around entire expression to prevent logical
+			// subexpressions associating with leading/trailing ^ / $.
+			buf.WriteRune('(')
+			addParens = true
+		}
+
+		switch ch {
+		case '$':
+			// Dollar signs need to be escaped unless they are at
+			// the end of the pattern, or are already escaped.
+			if !inEscape && i != len(pattern)-1 {
+				buf.WriteRune('\\')
+			}
+		case '^':
+			// Carets need to be escaped unless they are already
+			// escaped, indicating set negation ([^.*]) or at the
+			// start of the string.
+			if !inEscape && prevChar != '[' && i != 0 {
+				buf.WriteRune('\\')
+			}
+		}
+
+		// If the previous character was an escape character, then we
+		// leave the escape, otherwise check whether this is an escape
+		// char and if so, then enter escape.
+		inEscape = !inEscape && ch == '\\'
+
+		if i == len(pattern)-1 && addParens && ch == '$' {
+			buf.WriteRune(')')
+		}
+
+		buf.WriteRune(ch)
+
+		if i == len(pattern)-1 && ch != '$' {
+			if addParens {
+				buf.WriteRune(')')
+			}
+			buf.WriteRune('$')
+		}
+
+		prevChar = ch
+	}
+
+	return buf.String()
+}
+
 // IsConfig takes a yang.Entry and traverses up the tree to find the config
 // state of that element. In YANG, if the config parameter is unset, then it is
 // is inherited from the parent of the element - hence we must walk up the tree to find
diff --git a/ytypes/leaf.go b/ytypes/leaf.go
index fb2f3ee..57a7479 100644
--- a/ytypes/leaf.go
+++ b/ytypes/leaf.go
@@ -123,12 +123,12 @@ func validateLeaf(inSchema *yang.Entry, value interface{}) util.Errors {
    {
            Name:             "ipv4-address",
            Kind:             yang.Ystring,
-           Pattern:          [...pattern...],
+           POSIXPattern:          [...pattern...],
    },
    {
            Name:             "ipv6-address",
            Kind:             yang.Ystring,
-           Pattern:          [...pattern...],
+           POSIXPattern:          [...pattern...],
            Type:             [],
    }]
  }
@@ -156,7 +156,7 @@ func validateLeaf(inSchema *yang.Entry, value interface{}) util.Errors {
    {
            Name:             "port-string",
            Kind:             yang.Ystring,
-           Pattern:          [...pattern...],
+           POSIXPattern:          [...pattern...],
    },
    {
            Name:             "port-integer",
diff --git a/ytypes/string_type.go b/ytypes/string_type.go
index 7e166a2..2427832 100644
--- a/ytypes/string_type.go
+++ b/ytypes/string_type.go
@@ -15,13 +15,13 @@
 package ytypes
 
 import (
-	"bytes"
 	"fmt"
 	"reflect"
 	"regexp"
 	"unicode/utf8"
 
 	"github.com/openconfig/goyang/pkg/yang"
+	"github.com/openconfig/ygot/util"
 )
 
 // Refer to: https://tools.ietf.org/html/rfc6020#section-9.4.
@@ -53,13 +53,18 @@ func validateString(schema *yang.Entry, value interface{}) error {
 	}
 
 	// Check that the value satisfies any regex patterns.
-	for _, p := range schema.Type.Pattern {
-		r, err := regexp.Compile(fixYangRegexp(p))
+	patterns, isPOSIX := util.SanitizedPattern(schema.Type)
+	for _, p := range patterns {
+		var r *regexp.Regexp
+		var err error
+		if isPOSIX {
+			r, err = regexp.CompilePOSIX(p)
+		} else {
+			r, err = regexp.Compile(p)
+		}
 		if err != nil {
 			return err
 		}
-		// fixYangRegexp adds ^(...)$ around the pattern - the result is
-		// equivalent to a full match of whole string.
 		if !r.MatchString(stringVal) {
 			return fmt.Errorf("%q does not match regular expression pattern %q for schema %s", stringVal, r, schema.Name)
 		}
@@ -111,69 +116,18 @@ func validateStringSchema(schema *yang.Entry) error {
 		return fmt.Errorf("string schema %s has wrong type %v", schema.Name, schema.Type.Kind)
 	}
 
-	for _, p := range schema.Type.Pattern {
-		if _, err := regexp.Compile(fixYangRegexp(p)); err != nil {
+	patterns, isPOSIX := util.SanitizedPattern(schema.Type)
+	for _, p := range patterns {
+		var err error
+		if isPOSIX {
+			_, err = regexp.CompilePOSIX(p)
+		} else {
+			_, err = regexp.Compile(p)
+		}
+		if err != nil {
 			return fmt.Errorf("error generating regexp %s %v for schema %s", p, err, schema.Name)
 		}
 	}
 
 	return validateLengthSchema(schema)
 }
-
-// fixYangRegexp takes a pattern regular expression from a YANG module and
-// returns it into a format which can be used by the Go regular expression
-// library. YANG uses a W3C standard that is defined to be implicitly anchored
-// at the head or tail of the expression. See
-// https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#regexs for details.
-func fixYangRegexp(pattern string) string {
-	var buf bytes.Buffer
-	var inEscape bool
-	var prevChar rune
-	addParens := false
-
-	for i, ch := range pattern {
-		if i == 0 && ch != '^' {
-			buf.WriteRune('^')
-			// Add parens around entire expression to prevent logical
-			// subexpressions associating with leading/trailing ^ / $.
-			buf.WriteRune('(')
-			addParens = true
-		}
-
-		switch ch {
-		case '$':
-			// Dollar signs need to be escaped unless they are at
-			// the end of the pattern, or are already escaped.
-			if !inEscape && i != len(pattern)-1 {
-				buf.WriteRune('\\')
-			}
-		case '^':
-			// Carets need to be escaped unless they are already
-			// escaped, indicating set negation ([^.*]) or at the
-			// start of the string.
-			if !inEscape && prevChar != '[' && i != 0 {
-				buf.WriteRune('\\')
-			}
-		}
-
-		// If the previous character was an escape character, then we
-		// leave the escape, otherwise check whether this is an escape
-		// char and if so, then enter escape.
-		inEscape = !inEscape && ch == '\\'
-
-		buf.WriteRune(ch)
-
-		if i == len(pattern)-1 {
-			if addParens {
-				buf.WriteRune(')')
-			}
-			if ch != '$' {
-				buf.WriteRune('$')
-			}
-		}
-
-		prevChar = ch
-	}
-
-	return buf.String()
-}


Test patch:
diff --git a/util/debug_test.go b/util/debug_test.go
index 6fb9d95..7b6b173 100644
--- a/util/debug_test.go
+++ b/util/debug_test.go
@@ -175,15 +175,35 @@ func TestSchemaTypeStr(t *testing.T) {
 }
 
 func TestYangTypeToDebugString(t *testing.T) {
-	yangType := &yang.YangType{
-		Kind:    yang.Ystring,
-		Pattern: []string{"abc"},
-		Range:   yang.YangRange{yang.YRange{Min: YangMinNumber, Max: YangMaxNumber}},
-	}
+	tests := []struct {
+		desc    string
+		inType  *yang.YangType
+		wantStr string
+	}{{
+		desc: "POSIX",
+		inType: &yang.YangType{
+			Kind:         yang.Ystring,
+			Pattern:      []string{"abc"},
+			POSIXPattern: []string{"^abc$"},
+			Range:        yang.YangRange{yang.YRange{Min: YangMinNumber, Max: YangMaxNumber}},
+		},
+		wantStr: `(TypeKind: string, Sanitized pattern (POSIX: true): ^abc$, Range: min..max)`,
+	}, {
+		desc: "non-POSIX",
+		inType: &yang.YangType{
+			Kind:    yang.Ystring,
+			Pattern: []string{"abc"},
+			Range:   yang.YangRange{yang.YRange{Min: YangMinNumber, Max: YangMaxNumber}},
+		},
+		wantStr: `(TypeKind: string, Sanitized pattern (POSIX: false): ^(abc)$, Range: min..max)`,
+	}}
 
-	wantStr := `(TypeKind: string, Pattern: abc, Range: min..max)`
-	if got, want := YangTypeToDebugString(yangType), wantStr; got != want {
-		t.Errorf("got:\n%s\nwant:\n%s", got, want)
+	for _, tt := range tests {
+		t.Run(tt.desc, func(t *testing.T) {
+			if got, want := YangTypeToDebugString(tt.inType), tt.wantStr; got != want {
+				t.Errorf("got:\n%s\nwant:\n%s", got, want)
+			}
+		})
 	}
 }
 
diff --git a/util/yang_test.go b/util/yang_test.go
index 603b5de..8718818 100644
--- a/util/yang_test.go
+++ b/util/yang_test.go
@@ -66,6 +66,56 @@ func TestSchemaTreeRoot(t *testing.T) {
 	}
 }
 
+func TestSanitizedPattern(t *testing.T) {
+	tests := []struct {
+		desc        string
+		in          *yang.YangType
+		want        []string
+		wantIsPOSIX bool
+	}{{
+		desc: "both are present",
+		in: &yang.YangType{
+			Pattern:      []string{`abc`},
+			POSIXPattern: []string{`^def$`, `^ghi$`},
+		},
+		want:        []string{`^def$`, `^ghi$`},
+		wantIsPOSIX: true,
+	}, {
+		desc: "POSIXPattern only present",
+		in: &yang.YangType{
+			POSIXPattern: []string{``, `^def$`},
+		},
+		want:        []string{``, `^def$`},
+		wantIsPOSIX: true,
+	}, {
+		desc: "Pattern only present",
+		in: &yang.YangType{
+			Pattern: []string{`abc`},
+		},
+		want:        []string{`^(abc)$`},
+		wantIsPOSIX: false,
+	}, {
+		desc: "Pattern only present, with different sanitization behaviours",
+		in: &yang.YangType{
+			Pattern: []string{``, `^abc`, `^abc$`, `abc$`, `a$b^c[^d]\\\ne`},
+		},
+		want:        []string{``, `^abc$`, `^abc$`, `^(abc)$`, `^(a\$b\^c[^d]\\\ne)$`},
+		wantIsPOSIX: false,
+	}}
+
+	for _, tt := range tests {
+		t.Run(tt.desc, func(t *testing.T) {
+			gotPatterns, gotIsPOSIX := SanitizedPattern(tt.in)
+			if diff := cmp.Diff(gotPatterns, tt.want); diff != "" {
+				t.Errorf("(-got, +want):\n%s", diff)
+			}
+			if diff := cmp.Diff(gotIsPOSIX, tt.wantIsPOSIX); diff != "" {
+				t.Errorf("(-gotIsPOSIX, +wantIsPOSIX):\n%s", diff)
+			}
+		})
+	}
+}
+
 // TestYangHelperChecks tests a known set of input data against the helper
 // functions that check the type of a particular element in yanghelpers.go.
 func TestYangHelperChecks(t *testing.T) {
@@ -655,18 +705,20 @@ func TestIsYangTypes(t *testing.T) {
 				Type: &yang.YangType{
 					Kind: yang.Yunion,
 					Type: []*yang.YangType{{
-						Name:    "string",
-						Pattern: []string{"^a.*$"},
-						Kind:    yang.Ystring,
+						Name:         "string",
+						Pattern:      []string{"a.*"},
+						POSIXPattern: []string{"^a.*$"},
+						Kind:         yang.Ystring,
 						Length: yang.YangRange{{
 							Min: yang.FromInt(10),
 							Max: yang.FromInt(20),
 						},
 						},
 					}, {
-						Name:    "string",
-						Pattern: []string{"^b.*$"},
-						Kind:    yang.Ystring,
+						Name:         "string",
+						Pattern:      []string{"b.*"},
+						POSIXPattern: []string{"^b.*$"},
+						Kind:         yang.Ystring,
 						Length: yang.YangRange{{
 							Min: yang.FromInt(10),
 							Max: yang.FromInt(20),
@@ -688,9 +740,10 @@ func TestIsYangTypes(t *testing.T) {
 				Type: &yang.YangType{
 					Kind: yang.Yunion,
 					Type: []*yang.YangType{{
-						Name:    "string",
-						Pattern: []string{"^a.*$"},
-						Kind:    yang.Ystring,
+						Name:         "string",
+						Pattern:      []string{"a.*"},
+						POSIXPattern: []string{"^a.*$"},
+						Kind:         yang.Ystring,
 						Length: yang.YangRange{{
 							Min: yang.FromInt(10),
 							Max: yang.FromInt(20),
@@ -974,9 +1027,10 @@ var complexUnionType *yang.YangType = &yang.YangType{
 	Name: complexUnionTypeName,
 	Kind: yang.Yunion,
 	Type: []*yang.YangType{{
-		Name:    "string",
-		Pattern: []string{"^a.*$"},
-		Kind:    yang.Ystring,
+		Name:         "string",
+		Pattern:      []string{"a.*"},
+		POSIXPattern: []string{"^a.*$"},
+		Kind:         yang.Ystring,
 		Length: yang.YangRange{{
 			Min: yang.FromInt(10),
 			Max: yang.FromInt(20),
@@ -994,9 +1048,10 @@ var complexUnionType *yang.YangType = &yang.YangType{
 		Name: "union",
 		Kind: yang.Yunion,
 		Type: []*yang.YangType{{
-			Name:    "string",
-			Pattern: []string{"^b.*$"},
-			Kind:    yang.Ystring,
+			Name:         "string",
+			Pattern:      []string{"b.*"},
+			POSIXPattern: []string{"^b.*$"},
+			Kind:         yang.Ystring,
 			Length: yang.YangRange{{
 				Min: yang.FromInt(10),
 				Max: yang.FromInt(20),
@@ -1014,9 +1069,10 @@ var complexUnionType *yang.YangType = &yang.YangType{
 			Name: "inner-typedef-union",
 			Kind: yang.Yunion,
 			Type: []*yang.YangType{{
-				Name:    "string",
-				Pattern: []string{"^c.*$"},
-				Kind:    yang.Ystring,
+				Name:         "string",
+				Pattern:      []string{"c.*"},
+				POSIXPattern: []string{"^c.*$"},
+				Kind:         yang.Ystring,
 				Length: yang.YangRange{{
 					Min: yang.FromInt(10),
 					Max: yang.FromInt(20),
@@ -1036,9 +1092,10 @@ var complexUnionType *yang.YangType = &yang.YangType{
 		Name: "typedef-union",
 		Kind: yang.Yunion,
 		Type: []*yang.YangType{{
-			Name:    "string",
-			Pattern: []string{"^d.*$"},
-			Kind:    yang.Ystring,
+			Name:         "string",
+			Pattern:      []string{"d.*"},
+			POSIXPattern: []string{"^d.*$"},
+			Kind:         yang.Ystring,
 			Length: yang.YangRange{{
 				Min: yang.FromInt(10),
 				Max: yang.FromInt(20),
@@ -1056,9 +1113,10 @@ var complexUnionType *yang.YangType = &yang.YangType{
 			Name: "nested-typedef-union",
 			Kind: yang.Yunion,
 			Type: []*yang.YangType{{
-				Name:    "string",
-				Pattern: []string{"^e.*$"},
-				Kind:    yang.Ystring,
+				Name:         "string",
+				Pattern:      []string{"e.*"},
+				POSIXPattern: []string{"^e.*$"},
+				Kind:         yang.Ystring,
 				Length: yang.YangRange{{
 					Min: yang.FromInt(10),
 					Max: yang.FromInt(20),
@@ -1078,9 +1136,10 @@ var complexUnionType *yang.YangType = &yang.YangType{
 		Name: "typedef-union2",
 		Kind: yang.Yunion,
 		Type: []*yang.YangType{{
-			Name:    "string",
-			Pattern: []string{"^f.*$"},
-			Kind:    yang.Ystring,
+			Name:         "string",
+			Pattern:      []string{"f.*"},
+			POSIXPattern: []string{"^f.*$"},
+			Kind:         yang.Ystring,
 			Length: yang.YangRange{{
 				Min: yang.FromInt(10),
 				Max: yang.FromInt(20),
@@ -1098,9 +1157,10 @@ var complexUnionType *yang.YangType = &yang.YangType{
 			Name: "nested-typedef-union2",
 			Kind: yang.Yunion,
 			Type: []*yang.YangType{{
-				Name:    "string",
-				Pattern: []string{"^g.*$"},
-				Kind:    yang.Ystring,
+				Name:         "string",
+				Pattern:      []string{"g.*"},
+				POSIXPattern: []string{"^g.*$"},
+				Kind:         yang.Ystring,
 				Length: yang.YangRange{{
 					Min: yang.FromInt(10),
 					Max: yang.FromInt(20),
@@ -1247,9 +1307,10 @@ func TestEnumeratedUnionTypes(t *testing.T) {
 	}{{
 		desc: "single-level with no enumerated types",
 		inTypes: []*yang.YangType{{
-			Name:    "string",
-			Pattern: []string{"^a.*$"},
-			Kind:    yang.Ystring,
+			Name:         "string",
+			Pattern:      []string{"a.*"},
+			POSIXPattern: []string{"^a.*$"},
+			Kind:         yang.Ystring,
 			Length: yang.YangRange{{
 				Min: yang.FromInt(10),
 				Max: yang.FromInt(20),
@@ -1262,9 +1323,10 @@ func TestEnumeratedUnionTypes(t *testing.T) {
 	}, {
 		desc: "single-level with mixed types",
 		inTypes: []*yang.YangType{{
-			Name:    "string",
-			Pattern: []string{"^a.*$"},
-			Kind:    yang.Ystring,
+			Name:         "string",
+			Pattern:      []string{"a.*"},
+			POSIXPattern: []string{"^a.*$"},
+			Kind:         yang.Ystring,
 			Length: yang.YangRange{{
 				Min: yang.FromInt(10),
 				Max: yang.FromInt(20),
@@ -1293,9 +1355,10 @@ func TestEnumeratedUnionTypes(t *testing.T) {
 	}, {
 		desc: "multi-level with mixed types",
 		inTypes: []*yang.YangType{{
-			Name:    "string",
-			Pattern: []string{"^a.*$"},
-			Kind:    yang.Ystring,
+			Name:         "string",
+			Pattern:      []string{"a.*"},
+			POSIXPattern: []string{"^a.*$"},
+			Kind:         yang.Ystring,
 			Length: yang.YangRange{{
 				Min: yang.FromInt(10),
 				Max: yang.FromInt(20),
@@ -1310,9 +1373,10 @@ func TestEnumeratedUnionTypes(t *testing.T) {
 			Name: "union",
 			Kind: yang.Yunion,
 			Type: []*yang.YangType{{
-				Name:    "string",
-				Pattern: []string{"^a.*$"},
-				Kind:    yang.Ystring,
+				Name:         "string",
+				Pattern:      []string{"a.*"},
+				POSIXPattern: []string{"^a.*$"},
+				Kind:         yang.Ystring,
 				Length: yang.YangRange{{
 					Min: yang.FromInt(10),
 					Max: yang.FromInt(20),
@@ -1412,9 +1476,10 @@ func TestEnumeratedUnionTypes(t *testing.T) {
 
 func TestDefiningType(t *testing.T) {
 	strType := &yang.YangType{
-		Name:    "string",
-		Pattern: []string{"^a.*$"},
-		Kind:    yang.Ystring,
+		Name:         "string",
+		Pattern:      []string{"a.*"},
+		POSIXPattern: []string{"^a.*$"},
+		Kind:         yang.Ystring,
 		Length: yang.YangRange{{
 			Min: yang.FromInt(10),
 			Max: yang.FromInt(20),
diff --git a/ygen/protoelements_test.go b/ygen/protoelements_test.go
index 767d95c..4937018 100644
--- a/ygen/protoelements_test.go
+++ b/ygen/protoelements_test.go
@@ -360,11 +360,13 @@ func TestYangTypeToProtoType(t *testing.T) {
 			yangType: &yang.YangType{
 				Kind: yang.Yunion,
 				Type: []*yang.YangType{{
-					Kind:    yang.Ystring,
-					Pattern: []string{"a.*"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"a.*"},
+					POSIXPattern: []string{"^a.*$"},
 				}, {
-					Kind:    yang.Ystring,
-					Pattern: []string{"b.*"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"b.*"},
+					POSIXPattern: []string{"^b.*$"},
 				}},
 			},
 		}},
diff --git a/ygen/protogen_test.go b/ygen/protogen_test.go
index 514d418..a01d192 100644
--- a/ygen/protogen_test.go
+++ b/ygen/protogen_test.go
@@ -1601,8 +1601,8 @@ func TestGenListKeyProto(t *testing.T) {
 						Type: &yang.YangType{
 							Kind: yang.Yunion,
 							Type: []*yang.YangType{
-								{Kind: yang.Ystring, Pattern: []string{"b.*"}},
-								{Kind: yang.Ystring, Pattern: []string{"a.*"}},
+								{Kind: yang.Ystring, POSIXPattern: []string{"^b.*$"}},
+								{Kind: yang.Ystring, POSIXPattern: []string{"^a.*$"}},
 							},
 						},
 					},
diff --git a/ygen/testdata/schema/openconfig-extensions.yang b/ygen/testdata/schema/openconfig-extensions.yang
new file mode 100644
index 0000000..c5e24ba
--- /dev/null
+++ b/ygen/testdata/schema/openconfig-extensions.yang
@@ -0,0 +1,198 @@
+module openconfig-extensions {
+
+  yang-version "1";
+
+  // namespace
+  namespace "http://openconfig.net/yang/openconfig-ext";
+
+  prefix "oc-ext";
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "This module provides extensions to the YANG language to allow
+    OpenConfig specific functionality and meta-data to be defined.";
+
+  revision "2020-06-16" {
+    description
+      "Add extension for POSIX pattern statements.";
+    reference "0.5.0";
+  }
+
+  revision "2018-10-17" {
+    description
+      "Add extension for regular expression type.";
+    reference "0.4.0";
+  }
+
+  revision "2017-04-11" {
+    description
+      "rename password type to 'hashed' and clarify description";
+    reference "0.3.0";
+  }
+
+  revision "2017-01-29" {
+    description
+      "Added extension for annotating encrypted values.";
+    reference "0.2.0";
+  }
+
+  revision "2015-10-09" {
+    description
+      "Initial OpenConfig public release";
+    reference "0.1.0";
+  }
+
+
+  // extension statements
+  extension openconfig-version {
+    argument "semver" {
+      yin-element false;
+    }
+    description
+      "The OpenConfig version number for the module. This is
+      expressed as a semantic version number of the form:
+        x.y.z
+      where:
+        * x corresponds to the major version,
+        * y corresponds to a minor version,
+        * z corresponds to a patch version.
+      This version corresponds to the model file within which it is
+      defined, and does not cover the whole set of OpenConfig models.
+
+      Individual YANG modules are versioned independently -- the
+      semantic version is generally incremented only when there is a
+      change in the corresponding file.  Submodules should always
+      have the same semantic version as their parent modules.
+
+      A major version number of 0 indicates that this model is still
+      in development (whether within OpenConfig or with industry
+      partners), and is potentially subject to change.
+
+      Following a release of major version 1, all modules will
+      increment major revision number where backwards incompatible
+      changes to the model are made.
+
+      The minor version is changed when features are added to the
+      model that do not impact current clients use of the model.
+
+      The patch-level version is incremented when non-feature changes
+      (such as bugfixes or clarifications to human-readable
+      descriptions that do not impact model functionality) are made
+      that maintain backwards compatibility.
+
+      The version number is stored in the module meta-data.";
+  }
+
+  extension openconfig-hashed-value {
+    description
+      "This extension provides an annotation on schema nodes to
+      indicate that the corresponding value should be stored and
+      reported in hashed form.
+
+      Hash algorithms are by definition not reversible. Clients
+      reading the configuration or applied configuration for the node
+      should expect to receive only the hashed value. Values written
+      in cleartext will be hashed. This annotation may be used on
+      nodes such as secure passwords in which the device never reports
+      a cleartext value, even if the input is provided as cleartext.";
+  }
+
+  extension regexp-posix {
+     description
+      "This extension indicates that the regular expressions included
+      within the YANG module specified are conformant with the POSIX
+      regular expression format rather than the W3C standard that is
+      specified by RFC6020 and RFC7950.";
+  }
+
+  extension posix-pattern {
+    argument "pattern" {
+      yin-element false;
+    }
+    description
+      "Provides a POSIX ERE regular expression pattern statement as an
+      alternative to YANG regular expresssions based on XML Schema Datatypes.
+      It is used the same way as the standard YANG pattern statement defined in
+      RFC6020 and RFC7950, but takes an argument that is a POSIX ERE regular
+      expression string.";
+    reference
+      "POSIX Extended Regular Expressions (ERE) Specification:
+      https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04";
+  }
+
+  extension telemetry-on-change {
+    description
+      "The telemetry-on-change annotation is specified in the context
+      of a particular subtree (container, or list) or leaf within the
+      YANG schema. Where specified, it indicates that the value stored
+      by the nodes within the context change their value only in response
+      to an event occurring. The event may be local to the target, for
+      example - a configuration change, or external - such as the failure
+      of a link.
+
+      When a telemetry subscription allows the target to determine whether
+      to export the value of a leaf in a periodic or event-based fashion
+      (e.g., TARGET_DEFINED mode in gNMI), leaves marked as
+      telemetry-on-change should only be exported when they change,
+      i.e., event-based.";
+  }
+
+  extension telemetry-atomic {
+    description
+      "The telemetry-atomic annotation is specified in the context of
+      a subtree (containre, or list), and indicates that all nodes
+      within the subtree are always updated together within the data
+      model. For example, all elements under the subtree may be updated
+      as a result of a new alarm being raised, or the arrival of a new
+       protocol message.
+
+      Transport protocols may use the atomic specification to determine
+      optimisations for sending or storing the corresponding data.";
+  }
+
+  extension operational {
+    description
+      "The operational annotation is specified in the context of a
+      grouping, leaf, or leaf-list within a YANG module. It indicates
+      that the nodes within the context are derived state on the device.
+
+      OpenConfig data models divide nodes into the following three categories:
+
+       - intended configuration - these are leaves within a container named
+         'config', and are the writable configuration of a target.
+       - applied configuration - these are leaves within a container named
+         'state' and are the currently running value of the intended configuration.
+       - derived state - these are the values within the 'state' container which
+         are not part of the applied configuration of the device. Typically, they
+         represent state values reflecting underlying operational counters, or
+         protocol statuses.";
+  }
+
+  extension catalog-organization {
+    argument "org" {
+      yin-element false;
+    }
+    description
+      "This extension specifies the organization name that should be used within
+      the module catalogue on the device for the specified YANG module. It stores
+      a pithy string where the YANG organization statement may contain more
+      details.";
+  }
+
+  extension origin {
+    argument "origin" {
+      yin-element false;
+    }
+    description
+      "This extension specifies the name of the origin that the YANG module
+      falls within. This allows multiple overlapping schema trees to be used
+      on a single network element without requiring module based prefixing
+      of paths.";
+  }
+}
diff --git a/ygen/testdata/schema/openconfig-options-compress-fakeroot-schema.json b/ygen/testdata/schema/openconfig-options-compress-fakeroot-schema.json
index b456851..518cbc7 100644
--- a/ygen/testdata/schema/openconfig-options-compress-fakeroot-schema.json
+++ b/ygen/testdata/schema/openconfig-options-compress-fakeroot-schema.json
@@ -107,6 +107,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9\\.]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9\\.]+$"
                                                         ]
                                                     },
                                                     {
@@ -114,6 +117,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9A-F:]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9A-F:]+$"
                                                         ]
                                                     }
                                                 ]
@@ -261,6 +267,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9\\.]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9\\.]+$"
                                                         ]
                                                     },
                                                     {
@@ -268,6 +277,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9A-F:]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9A-F:]+$"
                                                         ]
                                                     }
                                                 ]
diff --git a/ygen/testdata/schema/openconfig-options-compress-fakeroot.formatted-txt b/ygen/testdata/schema/openconfig-options-compress-fakeroot.formatted-txt
index 51c6758..076588e 100644
--- a/ygen/testdata/schema/openconfig-options-compress-fakeroot.formatted-txt
+++ b/ygen/testdata/schema/openconfig-options-compress-fakeroot.formatted-txt
@@ -355,74 +355,76 @@ var (
 	// fields within the struct.
 	ySchema = []byte{
 		0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5c, 0x5f, 0x6f, 0xdb, 0x36,
-		0x10, 0x7f, 0xd7, 0xa7, 0x10, 0xf8, 0xba, 0x38, 0x4e, 0x33, 0x6f, 0x99, 0xfd, 0xe6, 0x24, 0x35,
-		0x66, 0x74, 0xc9, 0x82, 0xa6, 0xeb, 0x4b, 0x6b, 0x14, 0xb4, 0x75, 0x96, 0x89, 0x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, 0xc7, 0xd5, 0x8b, 0x8c, 0x48, 0x00, 0x00,
 	}
 )
 
diff --git a/ygen/testdata/schema/openconfig-options-compress-schema.json b/ygen/testdata/schema/openconfig-options-compress-schema.json
index 989d2db..f69df6e 100644
--- a/ygen/testdata/schema/openconfig-options-compress-schema.json
+++ b/ygen/testdata/schema/openconfig-options-compress-schema.json
@@ -107,6 +107,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9\\.]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9\\.]+$"
                                                         ]
                                                     },
                                                     {
@@ -114,6 +117,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9A-F:]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9A-F:]+$"
                                                         ]
                                                     }
                                                 ]
@@ -261,6 +267,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9\\.]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9\\.]+$"
                                                         ]
                                                     },
                                                     {
@@ -268,6 +277,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9A-F:]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9A-F:]+$"
                                                         ]
                                                     }
                                                 ]
diff --git a/ygen/testdata/schema/openconfig-options-compress.formatted-txt b/ygen/testdata/schema/openconfig-options-compress.formatted-txt
index 9bab88a..b8b95a2 100644
--- a/ygen/testdata/schema/openconfig-options-compress.formatted-txt
+++ b/ygen/testdata/schema/openconfig-options-compress.formatted-txt
@@ -332,74 +332,76 @@ var (
 	// contents of a goyang yang.Entry struct, which defines the schema for the
 	// fields within the struct.
 	ySchema = []byte{
-		0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5c, 0x5b, 0x6f, 0xfa, 0x36,
-		0x14, 0x7f, 0xcf, 0xa7, 0x88, 0xfc, 0x3a, 0x28, 0xfd,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-		0xfd, 0x55, 0x0b, 0x14, 0x3d, 0x72, 0x2d, 0x17, 0xbe, 0xc3, 0x44, 0x9b, 0x9d, 0x86, 0x0e, 0xbd,
-		0x26, 0xe6, 0x05, 0x06, 0x31, 0xaa, 0x41, 0xce, 0x80, 0xc1, 0x89, 0xc0, 0x94, 0x5c, 0x63, 0x1f,
-		0x8b, 0x24, 0x37, 0x3f, 0xd7, 0x96, 0xb7, 0x68, 0x18, 0x98, 0x16, 0x7e, 0x1c, 0x9d, 0x69, 0x3b,
-		0xed, 0x6e, 0xa7, 0xfb, 0xeb, 0x45, 0xbb, 0xfb, 0xcb, 0x11, 0xd9, 0xd8, 0xd9, 0xcf, 0xac, 0x91,
-		0xb3, 0x1b, 0xf9, 0x0a, 0x1c, 0x01, 0x11, 0x42, 0xac, 0x09, 0x3d, 0x8f, 0x21, 0xce, 0xf5, 0x23,
-		0x6f, 0x49, 0x8a, 0x0d, 0xbe, 0x36, 0xf8, 0x9e, 0x4e, 0xf0, 0x25, 0x98, 0x12, 0x83, 0xd8, 0xfb,
-		0xa3, 0xab, 0x31, 0x37, 0x53, 0x7b, 0xef, 0xb1, 0x37, 0xdf, 0x34, 0x17, 0x0c, 0x13, 0x1f, 0x18,
-		0x84, 0x9a, 0x7c, 0xf7, 0xbf, 0x19, 0xc8, 0x78, 0x80, 0x42, 0x20, 0x46, 0xb4, 0x0d, 0x51, 0x08,
-		0x7a, 0x3d, 0x6f, 0x76, 0xdf, 0xde, 0xce, 0x46, 0x3f, 0x01, 0x6d, 0x39, 0x23, 0x67, 0x8f, 0xc1,
-		0xda, 0x22, 0x58, 0x85, 0x60, 0xbf, 0x39, 0xe8, 0x1d, 0x00, 0xc2, 0xe3, 0x89, 0xea, 0xb5, 0x9e,
-		0xcf, 0xfb, 0x84, 0x50, 0x01, 0x93, 0x84, 0x49, 0xed, 0x98, 0xce, 0x27, 0x33, 0x14, 0xc2, 0x08,
-		0x8a, 0x59, 0x42, 0xb3, 0x16, 0x8d, 0x10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x42, 0x33, 0xc4, 0x1a, 0x8d,
+		0x1b, 0x3d, 0x7c, 0xee, 0x7e, 0xfb, 0xeb, 0x7e, 0x74, 0x3b, 0x18, 0x7f, 0x02, 0xc6, 0xa2, 0x57,
+		0x46, 0x12, 0x26, 0xc7, 0x3e, 0x5c, 0x78, 0xb1, 0xd6, 0x8b, 0xf6, 0xe9, 0xe3, 0x66, 0xb8, 0x5c,
+		0x1b, 0x88, 0x30, 0x3b, 0x8d, 0xb4, 0xc7, 0x47, 0x2b, 0xa7, 0x93, 0x86, 0x15, 0xc2, 0xf3, 0x91,
+		0x6b, 0x51, 0x9e, 0xc5, 0x13, 0x35, 0x43, 0x1a, 0xd7, 0x21, 0xb0, 0x70, 0x8a, 0x79, 0x68, 0x08,
+		0x6c, 0x9d, 0x6a, 0x1e, 0x14, 0x0b, 0xef, 0x65, 0x56, 0x9f, 0x68, 0xa3, 0x4f, 0xb1, 0x02, 0xfb,
+		0x13, 0x73, 0x31, 0x10, 0x82, 0xe9, 0x55, 0x61, 0x77, 0x98, 0xbc, 0x8b, 0x50, 0x56, 0x60, 0x66,
+		0x58, 0x92, 0x34, 0x8a, 0x34, 0xaa, 0xa9, 0x3b, 0xf8, 0x68, 0x2e, 0xe4, 0x03, 0x0b, 0x10, 0x43,
+		0xc1, 0xcd, 0xb2, 0x10, 0x71, 0x02, 0x47, 0xd2, 0x6e, 0x12, 0xcc, 0xbd, 0xb4, 0xb9, 0x97, 0x36,
+		0xab, 0xb5, 0x98, 0x9b, 0x04, 0x73, 0x93, 0x60, 0xb6, 0x6b, 0x28, 0x37, 0x09, 0xf6, 0x62, 0xb5,
+		0x8a, 0x9b, 0x04, 0x73, 0xc9, 0xd7, 0x25, 0xdf, 0x63, 0x27, 0x5f, 0x37, 0x09, 0x66, 0x90, 0x25,
+		0xdc, 0x24, 0x98, 0x9b, 0x04, 0x73, 0x84, 0x6c, 0x24, 0xa4, 0x9b, 0x04, 0x7b, 0x15, 0x0d, 0xa2,
+		0x83, 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48, 0x00, 0x00,
 	}
 )
 
diff --git a/ygen/testdata/schema/openconfig-options-nocompress-fakeroot-schema.json b/ygen/testdata/schema/openconfig-options-nocompress-fakeroot-schema.json
index 4468e80..b0a8997 100644
--- a/ygen/testdata/schema/openconfig-options-nocompress-fakeroot-schema.json
+++ b/ygen/testdata/schema/openconfig-options-nocompress-fakeroot-schema.json
@@ -107,6 +107,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9\\.]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9\\.]+$"
                                                         ]
                                                     },
                                                     {
@@ -114,6 +117,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9A-F:]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9A-F:]+$"
                                                         ]
                                                     }
                                                 ]
@@ -262,6 +268,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9\\.]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9\\.]+$"
                                                         ]
                                                     },
                                                     {
@@ -269,6 +278,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9A-F:]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9A-F:]+$"
                                                         ]
                                                     }
                                                 ]
diff --git a/ygen/testdata/schema/openconfig-options-nocompress-fakeroot.formatted-txt b/ygen/testdata/schema/openconfig-options-nocompress-fakeroot.formatted-txt
index 20796e0..b113b11 100644
--- a/ygen/testdata/schema/openconfig-options-nocompress-fakeroot.formatted-txt
+++ b/ygen/testdata/schema/openconfig-options-nocompress-fakeroot.formatted-txt
@@ -423,76 +423,78 @@ var (
 	// contents of a goyang yang.Entry struct, which defines the schema for the
 	// fields within the struct.
 	ySchema = []byte{
-		0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5c, 0x4b, 0x6f, 0xe3, 0x36,
-		0x10, 0xbe, 0xfb, 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4f, 0x65, 0x8d, 0x2b, 0xd9, 0xdc, 0x5c, 0xe7, 0x9d,
-		0x5b, 0xdf, 0xe0, 0xc0, 0x82, 0x97, 0xe7, 0x48, 0x24, 0xcb, 0x27, 0x53, 0xf9, 0xe2, 0xed, 0xd1,
-		0x25, 0x36, 0xb6, 0x03, 0xb0, 0x16, 0x08, 0x15, 0x40, 0x14, 0x81, 0x51, 0x05, 0x08, 0x0d, 0x14,
-		0x1a, 0x30, 0x75, 0xe0, 0xda, 0x01, 0x5c, 0x02, 0xe4, 0x5a, 0x40, 0x17, 0x80, 0x5d, 0xef, 0x83,
-		0x79, 0x7c, 0xd7, 0xb9, 0x60, 0x35, 0xcc, 0xca, 0x70, 0x63, 0x60, 0x47, 0xc2, 0x8f, 0xa5, 0x81,
-		0x36, 0x1d, 0xb4, 0x69, 0x81, 0xa7, 0xc7, 0x6a, 0x9a, 0xac, 0xa1, 0x8b, 0x32, 0x6d, 0xea, 0x07,
-		0x47, 0x15, 0x7a, 0x8a, 0x9e, 0xab, 0x80, 0x29, 0xc7, 0x29, 0xce, 0x5e, 0x8d, 0x4a, 0x68, 0x4a,
-		0xe9, 0x50, 0x4b, 0x93, 0x62, 0xba, 0x54, 0x33, 0xa6, 0x9c, 0x31, 0xf5, 0xf4, 0x29, 0xa8, 0x46,
-		0x45, 0x45, 0x4a, 0xa2, 0xa9, 0x59, 0x0f, 0x78, 0x89, 0x42, 0xbf, 0x2b, 0xd9, 0x44, 0xc3, 0xe9,
-		0x15, 0xc6, 0x6f, 0x22, 0x90, 0x3e, 0x2b, 0x89, 0x7b, 0x82, 0x1c, 0x86, 0x25, 0xb0, 0x09, 0x91,
-		0x0d, 0x09, 0x6d, 0x4a, 0x6c, 0x6b, 0x04, 0xb7, 0x46, 0x74, 0x73, 0xc2, 0xe3, 0x88, 0x8f, 0x5c,
-		0x00, 0xb5, 0x79, 0x5f, 0xa7, 0x31, 0x98, 0x21, 0x9d, 0x32, 0x2e, 0x7f, 0x3e, 0xd5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0xfd, 0x84, 0xf5, 0xcf, 0xba, 0x97,
+		0xb4, 0xa0, 0xdc, 0xd1, 0xec, 0x85, 0x14, 0xf9, 0x1e, 0x9c, 0x0d, 0x56, 0xaa, 0x59, 0xd7, 0xf4,
+		0x46, 0x20, 0x05, 0x5b, 0xea, 0x16, 0xbc, 0xec, 0x33, 0xff, 0x54, 0xec, 0x74, 0xd5, 0x0e, 0x09,
+		0x8b, 0xaf, 0xe8, 0xdf, 0xf0, 0x29, 0x0c, 0x97, 0xa3, 0xf2, 0xe2, 0xae, 0xc9, 0xf7, 0xb7, 0x6a,
+		0xfb, 0xba, 0xcc, 0xdf, 0xc8, 0x94, 0x2b, 0x6c, 0xa5, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x01,
+		0x00, 0x00, 0xff, 0xff, 0x46, 0x34, 0x04, 0x0f, 0xb0, 0x49, 0x00, 0x00,
 	}
 )
 
diff --git a/ygen/testdata/schema/openconfig-options-nocompress-schema.json b/ygen/testdata/schema/openconfig-options-nocompress-schema.json
index 954f4af..4bc2721 100644
--- a/ygen/testdata/schema/openconfig-options-nocompress-schema.json
+++ b/ygen/testdata/schema/openconfig-options-nocompress-schema.json
@@ -107,6 +107,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9\\.]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9\\.]+$"
                                                         ]
                                                     },
                                                     {
@@ -114,6 +117,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9A-F:]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9A-F:]+$"
                                                         ]
                                                     }
                                                 ]
@@ -262,6 +268,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9\\.]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9\\.]+$"
                                                         ]
                                                     },
                                                     {
@@ -269,6 +278,9 @@
                                                         "Kind": 18,
                                                         "Pattern": [
                                                             "[0-9A-F:]+"
+                                                        ],
+                                                        "POSIXPattern": [
+                                                            "^[0-9A-F:]+$"
                                                         ]
                                                     }
                                                 ]
diff --git a/ygen/testdata/schema/openconfig-options-nocompress.formatted-txt b/ygen/testdata/schema/openconfig-options-nocompress.formatted-txt
index 10275d4..1ff9b57 100644
--- a/ygen/testdata/schema/openconfig-options-nocompress.formatted-txt
+++ b/ygen/testdata/schema/openconfig-options-nocompress.formatted-txt
@@ -401,75 +401,77 @@ var (
 	// contents of a goyang yang.Entry struct, which defines the schema for the
 	// fields within the struct.
 	ySchema = []byte{
-		0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5c, 0xdd, 0x8f, 0xe2, 0x36,
-		0x10, 0x7f, 0xe7, 0xaf, 0x88, 0xfc, 0x5a, 0x58, 0xf6, 0x28, 0xed, 0x16, 0xde, 0xd8, 0xbb, 0x43,
-		0x45, 0xd7, 0xfd, 0xd0, 0xed, 0xf5, 0x5e, 0xee, 0x10, 0x32, 0xc4, 0x04, 0xab, 0xc1, 0x89, 0x1c,
-		0x47, 0x5d, 0x54, 0xe5, 0x7f, 0xaf, 0x42, 0x3e, 0xf6, 0x02, 0x01, 0x3c, 0xb6, 0xf9, 0x38, 0xe4,
-		0x37, 0x36, 0xc9, 0xcc, 0xd8, 0xf3, 0xfb, 0x39, 0x33, 0x1e, 0xcf, 0xe6, 0xbf, 0x86, 0xe3, 0x38,
-		0x0e, 0x7a, 0xc4, 0x4b, 0x82, 0xfa, 0x0e, 0x42, 0xcd, 0xec, 0xef, 0x4f, 0x94, 0xb9, 0xa8, 0xef,
-		0xdc, 0xe6, 0x7f, 0xbe, 0x0f, 0xd8, 0x9c, 0x7a, 0x3f, 0x5c, 0xf8, 0x40, 0x39, 0xea, 0x3b, 0x99,
-		0xf0, 0xfa, 0xc2, 0xd4, 0x0b, 0x2b, 0x17, 0x2a, 0x5a, 0xd3, 0x9b, 0xcd, 0xea, 0xad, 0xdc, 0xc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b3, 0xef, 0x33, 0x13, 0x20, 0x77, 0xd4, 0x7b, 0x21, 0x01, 0x7e, 0xc9,
-		0xe3, 0xc0, 0x2c, 0xe5, 0x66, 0x57, 0xf7, 0x4d, 0x13, 0x89, 0xb9, 0x54, 0x67, 0xf0, 0x36, 0xce,
-		0xec, 0x57, 0x3e, 0xd2, 0x5d, 0x23, 0x44, 0x34, 0x1a, 0xe2, 0x7f, 0xc8, 0xe7, 0x20, 0x28, 0xa2,
-		0x72, 0x26, 0xd5, 0x48, 0xfe, 0x07, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x1c,
-		0xf1, 0xba, 0xfe, 0x31, 0x46, 0x00, 0x00,
+		0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5c, 0x5f, 0x8f, 0xe2, 0x36,
+		0x10, 0x7f, 0xe7, 0x53, 0x44, 0x56, 0xdf, 0xba, 0x2c, 0x7b, 0x5b, 0xda, 0x2d, 0xbc, 0xb1, 0x77,
+		0x87, 0x8a, 0xae, 0xbb, 0xac, 0x8e, 0xeb, 0xa9, 0xd2, 0x1d, 0x45, 0x86, 0x98, 0x60, 0x35, 0x38,
+		0x91, 0xe3, 0xa8, 0x8b, 0xaa, 0x7c, 0xf7, 0x53, 0xc8, 0x9f, 0xbd, 0x40, 0x00, 0x8f, 0x6d, 0x58,
+		0x0e, 0xf9, 0x8d, 0x4d, 0xe2, 0x19, 0xcf, 0xfc, 0x7e, 0x66, 0x86, 0x99, 0xd9, 0xfc, 0xdf, 0x70,
+		0x1c, 0xc7, 0x41, 0x8f, 0x78, 0x49, 0x50, 0xd7, 0x41, 0xe8, 0x2a, 0xfb, 0xfb, 0x03, 0x65, 0x2e,
+		0xea, 0x3a, 0x37, 0xf9, 0x9f, 0x6f, 0x03, 0x36, 0xa7, 0xde, 0x77, 0x17, 0xde, 0x51, 0x8e, 0xba,
+		0x4e, 0xb6, 0x78, 0x7d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xd6, 0x7f, 0xf6, 0x7f, 0x20, 0x2b,
+		0xe0, 0x8f, 0x5c, 0x58, 0xa3, 0x40, 0xa9, 0x31, 0xa0, 0xd4, 0x08, 0x80, 0x15, 0xfe, 0x0f, 0xf9,
+		0x05, 0xc8, 0x3d, 0x65, 0xce, 0x21, 0xa9, 0x71, 0x45, 0x15, 0x96, 0xed, 0xe7, 0x57, 0x62, 0xe8,
+		0x85, 0x22, 0x92, 0x7e, 0x82, 0xfa, 0x67, 0xdf, 0x4b, 0x5a, 0x40, 0xee, 0xa8, 0xf7, 0x42, 0x02,
+		0x7c, 0x0f, 0xce, 0x01, 0x2b, 0xe5, 0xac, 0xab, 0x7b, 0x23, 0x90, 0x84, 0x2d, 0x55, 0x0b, 0x5e,
+		0xf6, 0x99, 0x7d, 0xca, 0x77, 0xba, 0x6b, 0x87, 0x88, 0x46, 0x7d, 0xfc, 0x2f, 0xf9, 0x18, 0x04,
+		0x45, 0x54, 0xce, 0x56, 0x35, 0x92, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xff,
+		0xff, 0xab, 0xa9, 0xab, 0x5d, 0x6f, 0x49, 0x00, 0x00,
 	}
 )
 
diff --git a/ygen/testdata/schema/openconfig-options.yang b/ygen/testdata/schema/openconfig-options.yang
index 9ef8bce..a312029 100644
--- a/ygen/testdata/schema/openconfig-options.yang
+++ b/ygen/testdata/schema/openconfig-options.yang
@@ -2,6 +2,8 @@ module openconfig-options {
   prefix "oco";
   namespace "urn:oco";
 
+  import openconfig-extensions { prefix oc-ext; }
+
   identity AFI;
   identity IPV4_UNICAST { base AFI; }
 
@@ -9,10 +11,12 @@ module openconfig-options {
     leaf peer-address {
       type union {
         type string {
-          pattern "[0-9\.]+";
+          pattern '[0-9\.]+';
+          oc-ext:posix-pattern '^[0-9\.]+$';
         }
         type string {
-          pattern "[0-9A-F:]+";
+          pattern '[0-9A-F:]+';
+          oc-ext:posix-pattern '^[0-9A-F:]+$';
         }
       }
     }
diff --git a/ytypes/leaf_list_test.go b/ytypes/leaf_list_test.go
index 85f23f1..73ec46b 100644
--- a/ytypes/leaf_list_test.go
+++ b/ytypes/leaf_list_test.go
@@ -199,8 +199,9 @@ func TestUnmarshalLeafListGNMIEncoding(t *testing.T) {
 				Name: "leaf",
 				Kind: yang.LeafEntry,
 				Type: &yang.YangType{
-					Kind:    yang.Ystring,
-					Pattern: []string{"b+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"b+"},
+					POSIXPattern: []string{"^b+$"},
 				},
 			},
 		},
@@ -230,8 +231,9 @@ func TestUnmarshalLeafListGNMIEncoding(t *testing.T) {
 			Kind: yang.Yunion,
 			Type: []*yang.YangType{
 				{
-					Kind:    yang.Ystring,
-					Pattern: []string{"a+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"a+"},
+					POSIXPattern: []string{"^a+$"},
 				},
 				{
 					Kind: yang.Yuint32,
diff --git a/ytypes/leaf_test.go b/ytypes/leaf_test.go
index 53cd8d6..d03e3e0 100644
--- a/ytypes/leaf_test.go
+++ b/ytypes/leaf_test.go
@@ -367,9 +367,10 @@ func TestValidateLeafUnion(t *testing.T) {
 					Kind: yang.Yunion,
 					Type: []*yang.YangType{
 						{
-							Name:    "string",
-							Kind:    yang.Ystring,
-							Pattern: []string{"a+"},
+							Name:         "string",
+							Kind:         yang.Ystring,
+							Pattern:      []string{"a+"},
+							POSIXPattern: []string{"^a+$"},
 						},
 						{
 							Name: "int16",
@@ -423,14 +424,16 @@ func TestValidateLeafUnion(t *testing.T) {
 					Kind: yang.Yunion,
 					Type: []*yang.YangType{
 						{
-							Name:    "string",
-							Kind:    yang.Ystring,
-							Pattern: []string{"a+"},
+							Name:         "string",
+							Kind:         yang.Ystring,
+							Pattern:      []string{"a+"},
+							POSIXPattern: []string{"^a+$"},
 						},
 						{
-							Name:    "string2",
-							Kind:    yang.Ystring,
-							Pattern: []string{"b+"},
+							Name:         "string2",
+							Kind:         yang.Ystring,
+							Pattern:      []string{"b+"},
+							POSIXPattern: []string{"^b+$"},
 						},
 					},
 				},
@@ -449,23 +452,26 @@ func TestValidateLeafUnion(t *testing.T) {
 					Kind: yang.Yunion,
 					Type: []*yang.YangType{
 						{
-							Name:    "string",
-							Kind:    yang.Ystring,
-							Pattern: []string{"a+"},
+							Name:         "string",
+							Kind:         yang.Ystring,
+							Pattern:      []string{"a+"},
+							POSIXPattern: []string{"^a+$"},
 						},
 						{
-							Name:    "string2",
-							Kind:    yang.Ystring,
-							Pattern: []string{"b+"},
+							Name:         "string2",
+							Kind:         yang.Ystring,
+							Pattern:      []string{"b+"},
+							POSIXPattern: []string{"^b+$"},
 						},
 						{
 							Name: "bad-leaf",
 							Kind: yang.Yunion,
 							Type: []*yang.YangType{
 								{
-									Name:    "bad-leaf",
-									Kind:    yang.Ystring,
-									Pattern: []string{"c+"},
+									Name:         "bad-leaf",
+									Kind:         yang.Ystring,
+									Pattern:      []string{"c+"},
+									POSIXPattern: []string{"^c+$"},
 								},
 							},
 						},
@@ -638,7 +644,11 @@ func TestValidateLeafRef(t *testing.T) {
 				"leaf-type": {
 					Kind: yang.LeafEntry,
 					Name: "leaf-type",
-					Type: &yang.YangType{Kind: yang.Ystring, Pattern: []string{"a+"}},
+					Type: &yang.YangType{
+						Kind:         yang.Ystring,
+						Pattern:      []string{"a+"},
+						POSIXPattern: []string{"^a+$"},
+					},
 				},
 			},
 		},
@@ -694,7 +704,11 @@ func TestValidateLeafRef(t *testing.T) {
 				"leaf-type": {
 					Kind: yang.LeafEntry,
 					Name: "leaf-type",
-					Type: &yang.YangType{Kind: yang.Ystring, Pattern: []string{"a+"}},
+					Type: &yang.YangType{
+						Kind:         yang.Ystring,
+						Pattern:      []string{"a+"},
+						POSIXPattern: []string{"^a+$"},
+					},
 				},
 			},
 		},
@@ -719,7 +733,11 @@ func TestValidateLeafRef(t *testing.T) {
 				"leaf-type": {
 					Kind: yang.LeafEntry,
 					Name: "leaf-type",
-					Type: &yang.YangType{Kind: yang.Ystring, Pattern: []string{"a+"}},
+					Type: &yang.YangType{
+						Kind:         yang.Ystring,
+						Pattern:      []string{"a+"},
+						POSIXPattern: []string{"^a+$"},
+					},
 				},
 			},
 		},
@@ -791,8 +809,9 @@ func TestValidateLeafRef(t *testing.T) {
 						"key": {
 							Name: "key",
 							Type: &yang.YangType{
-								Kind:    yang.Ystring,
-								Pattern: []string{"b.*"},
+								Kind:         yang.Ystring,
+								Pattern:      []string{"b.*"},
+								POSIXPattern: []string{"^b.*$"},
 							},
 						},
 					},
@@ -808,8 +827,9 @@ func TestValidateLeafRef(t *testing.T) {
 				"leaf2": {
 					Name: "leaf2",
 					Type: &yang.YangType{
-						Kind:    yang.Ystring,
-						Pattern: []string{"b.*"},
+						Kind:         yang.Ystring,
+						Pattern:      []string{"b.*"},
+						POSIXPattern: []string{"^b.*$"},
 					},
 				},
 			},
@@ -837,8 +857,9 @@ func TestValidateLeafRef(t *testing.T) {
 				"key": {
 					Name: "key",
 					Type: &yang.YangType{
-						Kind:    yang.Ystring,
-						Pattern: []string{"b.*"},
+						Kind:         yang.Ystring,
+						Pattern:      []string{"b.*"},
+						POSIXPattern: []string{"^b.*$"},
 					},
 				},
 			},
@@ -1319,8 +1340,9 @@ func TestUnmarshalLeafJSONEncoding(t *testing.T) {
 				Name: "leaf",
 				Kind: yang.LeafEntry,
 				Type: &yang.YangType{
-					Kind:    yang.Ystring,
-					Pattern: []string{"b+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"b+"},
+					POSIXPattern: []string{"^b+$"},
 				},
 			},
 		},
@@ -1390,8 +1412,9 @@ func TestUnmarshalLeafJSONEncoding(t *testing.T) {
 			Kind: yang.Yunion,
 			Type: []*yang.YangType{
 				{
-					Kind:    yang.Ystring,
-					Pattern: []string{"a+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"a+"},
+					POSIXPattern: []string{"^a+$"},
 				},
 				{
 					Kind: yang.Yuint32,
@@ -1418,8 +1441,9 @@ func TestUnmarshalLeafJSONEncoding(t *testing.T) {
 			Kind: yang.Yunion,
 			Type: []*yang.YangType{
 				{
-					Kind:    yang.Ystring,
-					Pattern: []string{"a+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"a+"},
+					POSIXPattern: []string{"^a+$"},
 				},
 				{
 					Kind: yang.Yuint32,
@@ -1443,12 +1467,14 @@ func TestUnmarshalLeafJSONEncoding(t *testing.T) {
 				{
 					// Note that Validate is not called as part of Unmarshal,
 					// therefore any string pattern will actually match.
-					Kind:    yang.Ystring,
-					Pattern: []string{"a+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"a+"},
+					POSIXPattern: []string{"^a+$"},
 				},
 				{
-					Kind:    yang.Ystring,
-					Pattern: []string{"b+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"b+"},
+					POSIXPattern: []string{"^b+$"},
 				},
 			},
 		},
@@ -1464,12 +1490,14 @@ func TestUnmarshalLeafJSONEncoding(t *testing.T) {
 				{
 					// Note that Validate is not called as part of Unmarshal,
 					// therefore any string pattern will actually match.
-					Kind:    yang.Ystring,
-					Pattern: []string{"a+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"a+"},
+					POSIXPattern: []string{"^a+$"},
 				},
 				{
-					Kind:    yang.Ystring,
-					Pattern: []string{"b+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"b+"},
+					POSIXPattern: []string{"^b+$"},
 				},
 			},
 		},
@@ -1678,8 +1706,9 @@ func TestUnmarshalLeafGNMIEncoding(t *testing.T) {
 				Name: "leaf",
 				Kind: yang.LeafEntry,
 				Type: &yang.YangType{
-					Kind:    yang.Ystring,
-					Pattern: []string{"b+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"b+"},
+					POSIXPattern: []string{"^b+$"},
 				},
 			},
 		},
@@ -1722,8 +1751,9 @@ func TestUnmarshalLeafGNMIEncoding(t *testing.T) {
 			Kind: yang.Yunion,
 			Type: []*yang.YangType{
 				{
-					Kind:    yang.Ystring,
-					Pattern: []string{"a+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"a+"},
+					POSIXPattern: []string{"^a+$"},
 				},
 				{
 					Kind: yang.Yuint32,
@@ -1793,12 +1823,14 @@ func TestUnmarshalLeafGNMIEncoding(t *testing.T) {
 				{
 					// Note that Validate is not called as part of Unmarshal,
 					// therefore any string pattern will actually match.
-					Kind:    yang.Ystring,
-					Pattern: []string{"a+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"a+"},
+					POSIXPattern: []string{"^a+$"},
 				},
 				{
-					Kind:    yang.Ystring,
-					Pattern: []string{"b+"},
+					Kind:         yang.Ystring,
+					Pattern:      []string{"b+"},
+					POSIXPattern: []string{"^b+$"},
 				},
 			},
 		},
diff --git a/ytypes/leafref_test.go b/ytypes/leafref_test.go
index 9714af7..d03cc8f 100644
--- a/ytypes/leafref_test.go
+++ b/ytypes/leafref_test.go
@@ -103,9 +103,10 @@ func TestValidateLeafRefData(t *testing.T) {
 					Kind: yang.Yunion,
 					Type: []*yang.YangType{
 						{
-							Name:    "string",
-							Kind:    yang.Ystring,
-							Pattern: []string{"a+"},
+							Name:         "string",
+							Kind:         yang.Ystring,
+							Pattern:      []string{"a+"},
+							POSIXPattern: []string{"^a+$"},
 						},
 						{
 							Name: "int16",
diff --git a/ytypes/list_test.go b/ytypes/list_test.go
index 572aa90..7499d2d 100644
--- a/ytypes/list_test.go
+++ b/ytypes/list_test.go
@@ -1924,9 +1924,10 @@ func TestUnmarshalUnionKeyedList(t *testing.T) {
 									Kind: yang.Yenum,
 								},
 								{
-									Name:    "string",
-									Kind:    yang.Ystring,
-									Pattern: []string{"a+"},
+									Name:         "string",
+									Kind:         yang.Ystring,
+									Pattern:      []string{"a+"},
+									POSIXPattern: []string{"^a+$"},
 								},
 								{
 									Name: "int16",
diff --git a/ytypes/schema_tests/validate_test.go b/ytypes/schema_tests/validate_test.go
index 2106b42..f8fb8ab 100644
--- a/ytypes/schema_tests/validate_test.go
+++ b/ytypes/schema_tests/validate_test.go
@@ -579,9 +579,15 @@ func TestValidateRoutingPolicy(t *testing.T) {
 	// type string {
 	//    pattern '^([0-9]+\.\.[0-9]+)|exact$';
 	// }
-	dev.RoutingPolicy.DefinedSets.PrefixSet["prefix1"].Prefix[prefixKey1].MasklengthRange = ygot.String("bad_element_key")
-	if err := dev.Validate(); err == nil {
-		t.Errorf("bad regex: got nil, want error")
+	badMaskLengthRange := "bad_element_key"
+	prefixKey1.MasklengthRange = badMaskLengthRange
+	dev.RoutingPolicy.DefinedSets.PrefixSet["prefix1"].Prefix[prefixKey1] = &oc.RoutingPolicy_DefinedSets_PrefixSet_Prefix{
+		IpPrefix:        ygot.String("255.255.255.0/20"),
+		MasklengthRange: ygot.String(badMaskLengthRange),
+	}
+	err := dev.Validate()
+	if diff := errdiff.Substring(err, "does not match regular expression pattern"); diff != "" {
+		t.Errorf("did not get expected bad regex error, %s", diff)
 	} else {
 		testErrLog(t, "bad regex", err)
 	}
diff --git a/ytypes/string_type_test.go b/ytypes/string_type_test.go
index 388bfab..f0e1b7d 100644
--- a/ytypes/string_type_test.go
+++ b/ytypes/string_type_test.go
@@ -21,10 +21,10 @@ import (
 	"github.com/openconfig/ygot/util"
 )
 
-var validStringSchema = yrangeAndPatternToStringSchema("valid-string-schema", yang.YRange{Min: yang.FromInt(2), Max: yang.FromInt(10)}, nil)
+var validStringSchema = yrangeAndPatternToStringSchema("valid-string-schema", yang.YRange{Min: yang.FromInt(2), Max: yang.FromInt(10)}, nil, nil)
 
-func yrangeAndPatternToStringSchema(schemaName string, yr yang.YRange, rePattern []string) *yang.Entry {
-	return &yang.Entry{Name: schemaName, Type: &yang.YangType{Kind: yang.Ystring, Length: yang.YangRange{yr}, Pattern: rePattern}}
+func yrangeAndPatternToStringSchema(schemaName string, yr yang.YRange, POSIXRePattern []string, rePattern []string) *yang.Entry {
+	return &yang.Entry{Name: schemaName, Type: &yang.YangType{Kind: yang.Ystring, Length: yang.YangRange{yr}, POSIXPattern: POSIXRePattern, Pattern: rePattern}}
 }
 
 func TestValidateStringSchema(t *testing.T) {
@@ -70,7 +70,7 @@ func TestValidateStringSchemaRanges(t *testing.T) {
 		desc       string
 		length     yang.YRange
 		schemaName string
-		re         []string
+		POSIXRe    []string
 		wantErr    bool
 	}{
 		{
@@ -82,19 +82,19 @@ func TestValidateStringSchemaRanges(t *testing.T) {
 			desc:       "unset min success",
 			length:     yang.YRange{Min: util.YangMinNumber, Max: yang.FromInt(10)},
 			schemaName: "range-10-or-less",
-			re:         []string{`ab.`, `.*bc`},
+			POSIXRe:    []string{`^ab.$`, `^.*bc$`},
 		},
 		{
 			desc:       "unset max success",
 			length:     yang.YRange{Min: yang.FromInt(2), Max: util.YangMaxNumber},
 			schemaName: "range-2-or-more",
-			re:         []string{`ab.`, `.*bc`},
+			POSIXRe:    []string{`^ab.$`, `^.*bc$`},
 		},
 		{
 			desc:       "unset min and max success",
 			length:     yang.YRange{Min: util.YangMinNumber, Max: util.YangMaxNumber},
 			schemaName: "range-any",
-			re:         []string{`ab.`, `.*bc`},
+			POSIXRe:    []string{`^ab.$`, `^.*bc$`},
 		},
 		{
 			desc:       "bad length range",
@@ -118,14 +118,14 @@ func TestValidateStringSchemaRanges(t *testing.T) {
 			desc:       "bad pattern",
 			length:     yang.YRange{Min: yang.FromInt(2), Max: yang.FromInt(10)},
 			schemaName: "bad-pattern",
-			re:         []string{"(^(.*)"},
+			POSIXRe:    []string{"(^(.*)"},
 			wantErr:    true,
 		},
 	}
 
 	for _, tt := range tests {
 		t.Run(tt.desc, func(t *testing.T) {
-			err := validateStringSchema(yrangeAndPatternToStringSchema(tt.schemaName, tt.length, tt.re))
+			err := validateStringSchema(yrangeAndPatternToStringSchema(tt.schemaName, tt.length, tt.POSIXRe, nil))
 			if got, want := (err != nil), tt.wantErr; got != want {
 				t.Errorf("%s: validateStringSchema got error: %v, want error? %v", tt.desc, err, tt.wantErr)
 			}
@@ -140,6 +140,7 @@ func TestValidateString(t *testing.T) {
 		length     yang.YRange
 		schemaName string
 		re         []string
+		POSIXRe    []string
 		val        interface{}
 		wantErr    bool
 	}{
@@ -148,13 +149,24 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: yang.FromInt(2), Max: yang.FromInt(10)},
 			schemaName: "range-2-to-10",
 			re:         []string{`ab.`, `.*bc`},
+			POSIXRe:    []string{`^ab.$`, `^.*bc$`},
 			val:        "abc",
 		},
+		{
+			desc:       "failure due to anchors",
+			length:     yang.YRange{Min: yang.FromInt(2), Max: yang.FromInt(10)},
+			schemaName: "range-2-to-10",
+			re:         []string{`ab.`, `.*bc`},
+			POSIXRe:    []string{`^ab.$`, `^.*bc$`},
+			val:        "abcc",
+			wantErr:    true,
+		},
 		{
 			desc:       "logical expression",
 			length:     yang.YRange{Min: yang.FromInt(2), Max: yang.FromInt(10)},
 			schemaName: "range-2-to-10",
 			re:         []string{`a+|\.`},
+			POSIXRe:    []string{`^(a+|\.)$`},
 			val:        "aaa aaa",
 			wantErr:    true,
 		},
@@ -163,6 +175,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: yang.FromInt(20), Max: yang.FromInt(10)},
 			schemaName: "bad-range",
 			re:         []string{`ab.`, `.*bc`},
+			POSIXRe:    []string{`^ab.$`, `^.*bc$`},
 			val:        "abc",
 			wantErr:    true,
 		},
@@ -171,6 +184,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: yang.FromInt(2), Max: yang.FromInt(10)},
 			schemaName: "range-2-to-10",
 			re:         []string{`ab.`, `.*bc`},
+			POSIXRe:    []string{`^ab.$`, `^.*bc$`},
 			val:        "acbc",
 			wantErr:    true,
 		},
@@ -179,6 +193,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: yang.FromInt(2), Max: yang.FromInt(10)},
 			schemaName: "range-2-to-10",
 			re:         []string{`[a|b]*`},
+			POSIXRe:    []string{`^[a|b]*$`},
 			val:        "abbbab",
 		},
 		{
@@ -186,6 +201,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: yang.FromInt(2), Max: yang.FromInt(10)},
 			schemaName: "range-2-to-10",
 			re:         []string{`[a|b]*`},
+			POSIXRe:    []string{`^[a|b]*$`},
 			val:        "abbcbab",
 			wantErr:    true,
 		},
@@ -194,6 +210,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: yang.FromInt(2), Max: yang.FromInt(10)},
 			schemaName: "range-2-to-10",
 			re:         []string{`ab.`, `.*bc`},
+			POSIXRe:    []string{`^ab.$`, `^.*bc$`},
 			val:        "acbc",
 			wantErr:    true,
 		},
@@ -223,6 +240,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: util.YangMinNumber, Max: util.YangMaxNumber},
 			schemaName: "range-any",
 			re:         []string{`[ab]{2}([cd])?`},
+			POSIXRe:    []string{`^[ab]{2}([cd])?$`},
 			val:        "abc",
 		},
 		{
@@ -230,6 +248,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: util.YangMinNumber, Max: util.YangMaxNumber},
 			schemaName: "range-any",
 			re:         []string{`[ab]{2}([cd])?`},
+			POSIXRe:    []string{`^[ab]{2}([cd])?$`},
 			val:        "cdb",
 			wantErr:    true,
 		},
@@ -238,6 +257,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: util.YangMinNumber, Max: util.YangMaxNumber},
 			schemaName: "range-any",
 			re:         []string{`[0-9]+`},
+			POSIXRe:    []string{`^[0-9]+$`},
 			val:        "abcd999",
 			wantErr:    true,
 		},
@@ -246,6 +266,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: util.YangMinNumber, Max: util.YangMaxNumber},
 			schemaName: "range-any",
 			re:         []string{`^[ab]{2}([cd])?$`},
+			POSIXRe:    []string{`^[ab]{2}([cd])?$`},
 			val:        "aad",
 		},
 		{
@@ -253,6 +274,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: util.YangMinNumber, Max: util.YangMaxNumber},
 			schemaName: "range-any",
 			re:         []string{`$[0-9]+`},
+			POSIXRe:    []string{`^\$[0-9]+$`},
 			val:        "$100",
 		},
 		{
@@ -260,6 +282,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: util.YangMinNumber, Max: util.YangMaxNumber},
 			schemaName: "range-any",
 			re:         []string{`[a-z]+^`},
+			POSIXRe:    []string{`^[a-z]+\^$`},
 			val:        "caret^",
 		},
 		{
@@ -267,6 +290,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: util.YangMinNumber, Max: util.YangMaxNumber},
 			schemaName: "range-any",
 			re:         []string{`[0-9]+\.[0-9]+`},
+			POSIXRe:    []string{`^[0-9]+\.[0-9]+$`},
 			val:        "10.10",
 		},
 		{
@@ -274,6 +298,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: util.YangMinNumber, Max: util.YangMaxNumber},
 			schemaName: "range-any",
 			re:         []string{`foo\\^bar`},
+			POSIXRe:    []string{`^foo\\\^bar$`},
 			val:        `foo\^bar`,
 		},
 		{
@@ -281,6 +306,7 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: util.YangMinNumber, Max: util.YangMaxNumber},
 			schemaName: "range-any",
 			re:         []string{`[^:][0-9a-fA-F]+`},
+			POSIXRe:    []string{`^[^:][0-9a-fA-F]+$`},
 			val:        ":FFFF",
 			wantErr:    true,
 		},
@@ -289,13 +315,23 @@ func TestValidateString(t *testing.T) {
 			length:     yang.YRange{Min: util.YangMinNumber, Max: util.YangMaxNumber},
 			schemaName: "range-any",
 			re:         []string{`[^:][0-9a-fA-F]+`},
+			POSIXRe:    []string{`^[^:][0-9a-fA-F]+$`},
 			val:        "CAFE",
 		},
 	}
 
 	for _, tt := range tests {
 		t.Run(tt.desc, func(t *testing.T) {
-			err := validateString(yrangeAndPatternToStringSchema(tt.schemaName, tt.length, tt.re), tt.val)
+			err := validateString(yrangeAndPatternToStringSchema(tt.schemaName, tt.length, tt.POSIXRe, tt.re), tt.val)
+			if got, want := (err != nil), tt.wantErr; got != want {
+				t.Errorf("%s: s.validateString(%v) got error: %v, want error? %t", tt.desc, tt.val, err, tt.wantErr)
+			}
+			testErrLog(t, tt.desc, err)
+		})
+
+		// Check backwards compatibility with POSIX regexes not present.
+		t.Run(tt.desc+" without POSIX pattern", func(t *testing.T) {
+			err := validateString(yrangeAndPatternToStringSchema(tt.schemaName, tt.length, nil, tt.re), tt.val)
 			if got, want := (err != nil), tt.wantErr; got != want {
 				t.Errorf("%s: s.validateString(%v) got error: %v, want error? %t", tt.desc, tt.val, err, tt.wantErr)
 			}