# Error: Regular expression is too wide-ranging and can't be executed efficiently

**URL:** <https://discuss.dgraph.io/t/error-regular-expression-is-too-wide-ranging-and-cant-be-executed-efficiently/3682>\
**Category:** Users\
**Created:** [December 3, 2018, 4:29pm UTC](https://discuss.dgraph.io/t/error-regular-expression-is-too-wide-ranging-and-cant-be-executed-efficiently/3682 "2018-12-03T16:29:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Awoogamuffin](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/awoogamuffin/32/1356_2.png) [@Awoogamuffin](https://discuss.dgraph.io/u/Awoogamuffin)\
**Post date:** [December 3, 2018, 4:29pm UTC](https://discuss.dgraph.io/t/error-regular-expression-is-too-wide-ranging-and-cant-be-executed-efficiently/3682/1 "2018-12-03T16:29:57Z")

</div>

Hello!

So imagine a user is searching through a sequence of nodes with a value for “name”. As they enter values into the searchbar, the list of returned results is whittled down (a very common scenario).

In MySQL I would use something like `"WHERE name LIKE('%$search%')"`. This would work whether $search was “Michael”, “Mic” or completely empty.

I figured that with dGraph this could be achieved with a trigram schema, and I use the following:

```auto
AND regexp(name, /.*${search[key]}.*/i)

```

But if the search value is too small, like “be”, I get this error:

```auto
Regular expression is too wide-ranging and can't be executed efficiently.

```

Is there a way to achieve something similar to the `var LIKE('%something%')` in dgraph?

---

<div class="post-metadata">

**Author:** ![gus](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/gus/32/1259_2.png) [@gus](https://discuss.dgraph.io/u/gus)\
**Post date:** [December 3, 2018, 6:37pm UTC](https://discuss.dgraph.io/t/error-regular-expression-is-too-wide-ranging-and-cant-be-executed-efficiently/3682/2 "2018-12-03T18:37:47Z")

</div>

Not at the moment. The best you can do is remove the leading `%` so that it’s not a range regex. This is an enhancement that we have been thinking about but we need to consider performance and compatibility.

---

<div class="post-metadata">

**Author:** ![u007](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/u007/32/1220_2.png) [@u007](https://discuss.dgraph.io/u/u007)\
**Post date:** [December 4, 2018, 6:46am UTC](https://discuss.dgraph.io/t/error-regular-expression-is-too-wide-ranging-and-cant-be-executed-efficiently/3682/3 "2018-12-04T06:46:42Z")

</div>

please prioritize on this, its an essential features that might make people reconsider using dgraph… i think partial lookup is quite a norm.

maybe can be based on fulltext index?

---

<div class="post-metadata">

**Author:** ![u007](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/u007/32/1220_2.png) [@u007](https://discuss.dgraph.io/u/u007)\
**Post date:** [December 4, 2018, 9:09am UTC](https://discuss.dgraph.io/t/error-regular-expression-is-too-wide-ranging-and-cant-be-executed-efficiently/3682/4 "2018-12-04T09:09:25Z")

</div>

thank you guys 😃

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/2/2b38fdece2abe5814f2e51bee69d1e67fc304b0a.png) [@system](https://discuss.dgraph.io/u/system)\
**Post date:** [January 3, 2019, 9:09am UTC](https://discuss.dgraph.io/t/error-regular-expression-is-too-wide-ranging-and-cant-be-executed-efficiently/3682/5 "2019-01-03T09:09:25Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
