question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

$regex operator called with non regular expression

See original GitHub issue

I’m trying to search string using regex as below:

db.find({ consignee: { $regex: /test/ } }, function (err, docs) { console.log(docs); });

But it is throwing error Error: $regex operator called with non regular expression

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:6
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
codernodercommented, Nov 26, 2020

Use { $regex: new RegExp('test') } instead { $regex: /test/ }

2reactions
avallacommented, Jul 15, 2020

I replaced nedb with sqlite, performance are better and migration was not so painful

Read more comments on GitHub >

github_iconTop Results From Across the Web

NeDB regex operator called with non regular expression
NeDB regex operator called with non regular expression ... I'm trying to search string using regex as below: db.find({ consignee: { $regex: ...
Read more >
Regex - Common Operators
This operator concatenates two regular expressions a and b . No character represents this operator; you simply put b after a . The...
Read more >
Regular Expression (Regex) Tutorial
The + , known as occurrence indicator (or repetition operator), indicates one or more occurrences ( 1+ ) of the previous sub-expression. In...
Read more >
Regular expressions - JavaScript - MDN Web Docs
Unicode regular expressions do not support so-called "identity escapes"; that is, patterns where an escaping backslash is not needed and ...
Read more >
Regular Expressions
epsilon which denotes the empty string containing no characters. null which denotes the empty set of strings. Operators used in regular expressions include:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found