gitlab.com/evatix-go/core@v1.3.55/regexnew/MatchError.go (about)

     1  package regexnew
     2  
     3  // MatchError
     4  //
     5  // creates new regex using without lock (use in vars)
     6  // and then calls match.
     7  // On condition mismatch returns error
     8  // or else nil
     9  func MatchError(regex, comparing string) error {
    10  	regEx, err := Create(regex)
    11  
    12  	if regEx != nil && regEx.MatchString(comparing) {
    13  		return nil
    14  	}
    15  
    16  	return regExMatchValidationError(
    17  		regex,
    18  		comparing,
    19  		err,
    20  		regEx)
    21  }