@@ -122,7 +122,7 @@ func NotEqualNow(t *testing.T, actual, expect any, message ...string) error {
122122func Match (t * testing.T , val string , pattern * regexp.Regexp , message ... string ) error {
123123 t .Helper ()
124124
125- return tryMatchRegexp (t , false , val , pattern , message ... )
125+ return tryMatchRegexp (t , false , val , pattern , "" , message ... )
126126}
127127
128128// MatchNow tests whether the string matches the regular expression or not, and it will terminate
@@ -135,7 +135,7 @@ func Match(t *testing.T, val string, pattern *regexp.Regexp, message ...string)
135135func MatchNow (t * testing.T , val string , pattern * regexp.Regexp , message ... string ) error {
136136 t .Helper ()
137137
138- return tryMatchRegexp (t , true , val , pattern , message ... )
138+ return tryMatchRegexp (t , true , val , pattern , "" , message ... )
139139}
140140
141141// MatchString will compile the pattern and test whether the string matches the regular expression
@@ -146,9 +146,7 @@ func MatchNow(t *testing.T, val string, pattern *regexp.Regexp, message ...strin
146146func MatchString (t * testing.T , val , pattern string , message ... string ) error {
147147 t .Helper ()
148148
149- regPattern := regexp .MustCompile (pattern )
150-
151- return tryMatchRegexp (t , false , val , regPattern , message ... )
149+ return tryMatchRegexp (t , false , val , nil , pattern , message ... )
152150}
153151
154152// MatchStringNow will compile the pattern and test whether the string matches the regular
@@ -161,9 +159,7 @@ func MatchString(t *testing.T, val, pattern string, message ...string) error {
161159func MatchStringNow (t * testing.T , val , pattern string , message ... string ) error {
162160 t .Helper ()
163161
164- regPattern := regexp .MustCompile (pattern )
165-
166- return tryMatchRegexp (t , true , val , regPattern , message ... )
162+ return tryMatchRegexp (t , true , val , nil , pattern , message ... )
167163}
168164
169165// NotMatch tests whether the string matches the regular expression or not, and it set the result
@@ -175,7 +171,7 @@ func MatchStringNow(t *testing.T, val, pattern string, message ...string) error
175171func NotMatch (t * testing.T , val string , pattern * regexp.Regexp , message ... string ) error {
176172 t .Helper ()
177173
178- return tryNotMatchRegexp (t , false , val , pattern , message ... )
174+ return tryNotMatchRegexp (t , false , val , pattern , "" , message ... )
179175}
180176
181177// NotMatchNow tests whether the string matches the regular expression or not, and it will
@@ -188,7 +184,7 @@ func NotMatch(t *testing.T, val string, pattern *regexp.Regexp, message ...strin
188184func NotMatchNow (t * testing.T , val string , pattern * regexp.Regexp , message ... string ) error {
189185 t .Helper ()
190186
191- return tryNotMatchRegexp (t , true , val , pattern , message ... )
187+ return tryNotMatchRegexp (t , true , val , pattern , "" , message ... )
192188}
193189
194190// MatchString will compile the pattern and test whether the string matches the regular expression
@@ -200,9 +196,7 @@ func NotMatchNow(t *testing.T, val string, pattern *regexp.Regexp, message ...st
200196func NotMatchString (t * testing.T , val , pattern string , message ... string ) error {
201197 t .Helper ()
202198
203- regPattern := regexp .MustCompile (pattern )
204-
205- return tryNotMatchRegexp (t , false , val , regPattern , message ... )
199+ return tryNotMatchRegexp (t , false , val , nil , pattern , message ... )
206200}
207201
208202// NotMatchStringNow will compile the pattern and test whether the string matches the regular
@@ -216,9 +210,7 @@ func NotMatchString(t *testing.T, val, pattern string, message ...string) error
216210func NotMatchStringNow (t * testing.T , val , pattern string , message ... string ) error {
217211 t .Helper ()
218212
219- regPattern := regexp .MustCompile (pattern )
220-
221- return tryNotMatchRegexp (t , true , val , regPattern , message ... )
213+ return tryNotMatchRegexp (t , true , val , nil , pattern , message ... )
222214}
223215
224216// Nil tests whether a value is nil or not, and it'll fail when the value is not nil. It will
0 commit comments