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

     1  package regexnew
     2  
     3  // MatchUsingFuncErrorLock
     4  //
     5  // creates new regex using lock
     6  // and then calls match.
     7  // On condition mismatch returns error
     8  // or else nil
     9  func MatchUsingFuncErrorLock(
    10  	regexPattern, comparing string,
    11  	matchFunc RegexValidationFunc,
    12  ) error {
    13  	regEx, err := CreateLock(regexPattern)
    14  
    15  	if regEx != nil && matchFunc(regEx, comparing) {
    16  		return nil
    17  	}
    18  
    19  	return regExMatchValidationError(
    20  		regexPattern,
    21  		comparing,
    22  		err,
    23  		regEx)
    24  }