Hi Dgraph People
I am trying to match string properties starting with capital letters, but I’m struggling to find a regex that fits the criteria for a trigram query.
Obvious non-trigram solutions include /^[A-Z]/
, /^[A-Z].*/
, and /^[A-Z].*$/
all of which fail with : Regular expression is too wide-ranging and can't be executed efficiently.
on efd1742
(current head of master).
There are a few seemingly undocumented (though possibly obvious) limitations that make this regex impossible:
-
^
and$
do not count towards matching runes. You tell tell because/^a$/
is too wide ranging. So we have to include two of this.
or[a-zA-Z]
after the initial[A-Z]
to match a full trigram. - Wildcards in the middle of a set of three characters make the query too wide ranging:
/aa.a/
and/aa.*a/
is too wide ranging while/aaa/
is fine. Perhaps this is expected behaviour, but based on the documentation/aa.*a/
surely matches the trigram “aaa”, so I don’t see why it would fail. - Three character regexes have to have an extremely limited range of possibilities -
/aa[A-U]/
is too wide ranging, and it surely only matches 21 possibilities. So/[A-Z][A-Za-z][A-Za-z]/
and/[A-Z]../
seem totally out of the question.
Is there any hope to get this kind of query working? Should I do some kind of post processing instead?