0

im trying to search one of my collections using a regular expression like this

db.tweets.find({tweet_text:new RegExp("\u[\x{0621}-\x{0670}]")},{tweet_text:1})

but an error occurs saying: Tue Mar 27 15:16:58 SyntaxError: invalid range in character class (shell):1

in php and perl i use the same regular expression and add the "\u" option to indicate using utf8 and it works well the problem is that mongodb regex does not have this option,is there an alternative to it?!

abugnais
  • 188
  • 1
  • 8

1 Answers1

1

The correct syntax for RegExp in javascript is:

new RegExp("[\u0621-\u0670]");
Ren
  • 678
  • 4
  • 6