gitlab.com/evatix-go/core@v1.3.55/regexnew/regExMatchValidationError.go (about) 1 package regexnew 2 3 import ( 4 "fmt" 5 "regexp" 6 ) 7 8 func regExMatchValidationError( 9 regex string, 10 comparing string, 11 err error, 12 regEx *regexp.Regexp, 13 ) error { 14 if err != nil { 15 return fmt.Errorf( 16 "[%q], regex pattern compile failed / invalid cannot match with [%q]", 17 err.Error(), 18 comparing) 19 } 20 21 if regEx == nil { 22 return fmt.Errorf( 23 "given regex pattern [%q] invalid cannot match with [%q]", 24 regex, 25 comparing) 26 } 27 28 return fmt.Errorf( 29 "given regex pattern [%q] doesn't match with [%q]", 30 regex, 31 comparing) 32 }