Strange regexp behavior

Dgraph shows an error for that

“message”: “: regular expression is too wide-ranging and can’t be executed efficiently”

I means that you can’t perform an expensive query at Root. Dgraph’s regexp design is based on indexing. That’s why is limited.

If regexp is to wide-ranging (like: .*), or more than 1000000 values are
returned for trigram, execution is stopped, because of performance
reasons.

Check Trigram indexing for regular expressions · dgraph-io/dgraph@a62fec2 · GitHub

Also there are changes incoming to regexp that I think will come in V1.1 RegExp filter work without filter (#2913) · dgraph-io/dgraph@a4756c2 · GitHub

it has:

return x.Errorf( "Attribute %v does not have trigram index for regex matching. "+
"Please add a trigram index or use has/uid function with regexp() as filter.", attr)	}

Not sure, but maybe you gonna be able to use the “normal” regexp but first adding the nodes using “has” to the query context and then filtering them by regexp.