diff --git a/rext/wrapper.go b/rext/wrapper.go index 08032a5..f17e6ee 100644 --- a/rext/wrapper.go +++ b/rext/wrapper.go @@ -1,6 +1,9 @@ package rext -import "regexp" +import ( + "gogs.mikescher.com/BlackForestBytes/goext/langext" + "regexp" +) type Regex interface { IsMatch(haystack string) bool @@ -156,6 +159,13 @@ func (g OptRegexMatchGroup) ValueOrEmpty() string { return g.v.Value() } +func (g OptRegexMatchGroup) ValueOrNil() *string { + if g.v == nil { + return nil + } + return langext.Ptr(g.v.Value()) +} + func (g OptRegexMatchGroup) IsEmpty() bool { return g.v == nil }