MCPcopy Create free account
hub / github.com/brimdata/super / NewRegexpBoolean

Function NewRegexpBoolean

runtime/sam/expr/boolean.go:244–255  ·  view source on GitHub ↗

NewRegexpBoolean returns a Boolean that compares values that must be a stringy the given regexp.

(re *regexp.Regexp)

Source from the content-addressed store, hash-verified

242// NewRegexpBoolean returns a Boolean that compares values that must
243// be a stringy the given regexp.
244func NewRegexpBoolean(re *regexp.Regexp) Boolean {
245 return func(val super.Value) super.Value {
246 if val.IsNull() {
247 return super.Null
248 }
249 v := false
250 if val.IsString() {
251 v = re.Match(val.Bytes())
252 }
253 return super.NewBool(v)
254 }
255}
256
257func CompareNull(op string) (Boolean, error) {
258 return func(val super.Value) super.Value {

Callers 1

compileRegexpSearchMethod · 0.92

Calls 5

NewBoolFunction · 0.92
IsNullMethod · 0.80
IsStringMethod · 0.80
MatchMethod · 0.80
BytesMethod · 0.45

Tested by

no test coverage detected