parse/value.go
func (v Value) Equal(val interface{}) bool {
	var str string
	var ok bool
	if str, ok = v.Data.(string); !ok {
		return v.Data == val
	}
	if isRegex(str) {
		// looks like regexp to me
		regex := regexp.MustCompile(str[1 : len(str)-1])
		// turn the value into a string
		valStr := fmt.Sprintf("%v", val)
		if regex.Match([]byte(valStr)) {
			return true
		}
	}
	return fmt.Sprintf("%v", v.Data) == fmt.Sprintf("%v", val)
}
func (v Value) Equal(val interface{}) bool {
	var str string
	var ok bool
	if str, ok = v.Data.(string); !ok {
		return v.Data == val
	}
	if isRegex(str) {
		// looks like regexp to me
		regex := regexp.MustCompile(str[1 : len(str)-1])
		// turn the value into a string
		valStr := fmt.Sprintf("%v", val)
		if regex.Match([]byte(valStr)) {
			return true
		}
	}
	return fmt.Sprintf("%v", v.Data) == fmt.Sprintf("%v", val)
}
func ( v Value ) Equal ( val interface { } ) bool { var str string var ok bool if str , ok = v . Data . ( string ) ; ! ok { return v . Data == val } if isRegex ( str ) { // looks like regexp to me regex := regexp . MustCompile ( str [ 1 : len ( str ) - 1 ] ) // turn the value into a string valStr := fmt . Sprintf ( " " , val ) if regex . Match ( [ ] byte ( valStr ) ) { return true } } return fmt . Sprintf ( " " , v . Data ) == fmt . Sprintf ( " " , val ) }
// Equal gets whether the Data and specified value are equal.
// Supports regexp values.
Equal gets whether the Data and specified value are equal . Supports regexp values .