Page 2 of 2

Query a an exact string while ignoring case

Posted: Mon Aug 31, 2015 10:12 am
by Shoeb Athar

I have a column File_Content in my DB having lot of text in string format.
keyword is input value to be searched.
I need to search specific words if the exact string matches.

I am using QUERY service with following code in JS:

1) return '{"File_Content":{"$regex":"^"'+keyword+'"$", "$options":"i"}}';
Not Working :(

2) return '{"File_Content": {"$regex": "^' + keyword + '$", "$options":"i"}}'
Not Working :(

3) return "{'File_Content':{'$regex':'(?i).^"+ keyword +"$'.'}}";
Not Working :(

If i remove ^ and $ every query works but not match exact string.

Please provide me solution to match exact string
Thanks in advance


Query a an exact string while ignoring case

Posted: Wed Sep 16, 2015 10:54 am
by Serhii Kulibaba

Hello Shoeb,

You shouldn't use "^" and "$" at the same time. Please use only one of them.