Skip to content

Commit

Permalink
refactor: naming consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
santhosh-tekuri committed Apr 20, 2024
1 parent fbdaf9d commit b32933c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions example_regex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
"github.com/santhosh-tekuri/jsonschema/v6"
)

type dclarkRegexp regexp2.Regexp
type dlclarkRegexp regexp2.Regexp

func (re *dclarkRegexp) MatchString(s string) bool {
func (re *dlclarkRegexp) MatchString(s string) bool {
matched, err := (*regexp2.Regexp)(re).MatchString(s)
return err == nil && matched
}

func (re *dclarkRegexp) String() string {
func (re *dlclarkRegexp) String() string {
return (*regexp2.Regexp)(re).String()
}

Expand All @@ -25,10 +25,12 @@ func dlclarkCompile(s string) (jsonschema.Regexp, error) {
if err != nil {
return nil, err
}
return (*dclarkRegexp)(re), nil
return (*dlclarkRegexp)(re), nil
}

func Example_customRegexEngine() {
// Example_customRegexpEngine shows how to use dlclark/regexp2
// instead of regexp from standard library.
func Example_customRegexpEngine() {
// golang regexp does not support escape sequence: `\c`
schema, err := jsonschema.UnmarshalJSON(strings.NewReader(`{
"type": "string",
Expand Down

0 comments on commit b32933c

Please sign in to comment.