Hey @llonchj,
Thanks for the quick reply. I was missing the “p” I just had regex! Not regexp. 
So this works:
function query(usernamePartialString: string): string {
return `query {
users(func: regexp(username, /${usernamePartialString}/))
{
uid
name
emailAddress
username
timezone
bio
}
}`;
}
when calling Dgraph....query(query('somestring'))
This however does not
const query = `query all($a: string) {
users(func: regexp(username, /$a/))
{
uid
name
emailAddress
username
timezone
bio
}
};`
when calling Dgraph.....queryWithVars(query, vars);
I get a Regular expression is too wide-ranging and can't be executed efficiently. Weird.
I can use the first method for now, so thanks again!