Adding 'regex' token to pass in a regular expression for find #26

Closed
wants to merge 1 commit into
from

3 participants

@kotedo

Hi Evan,

with this patch one can pass in something like this:

boss_db:find(article, [{title, 'regex', SearchTerm}])

where SearchTerm can be a PCRE regular expression.

--Kai

@evanmiller

Why don't you use "matches"? I don't see why a new keyword is necessary.

@kotedo
@kotedo

Hi Evan,

Nevermind. I just tried the 'matches' again and I can use it. But, one thing remains:

/SearchTerm/ and /SearchTerm/i are not working. SearchTerm can be anything, it always returns [].
Is there something I am overlooking?

http://docs.mongodb.org/manual/reference/operators/?highlight=regex#_S_regex
This is not working ...

--Kai

@evanmiller
@kotedo
@LordIvan

I also struck the same problem; trying to use 'matches' to do a case insensitive search when using mnesia DB adaptor... Any chance of any resolution?

@evanmiller

The convention is to prefix the regex with "*" if you want case-insensitive search.

Here are patches to support case-insensitive "matches" in Mnesia:

277c6d7
86e5729

@evanmiller

Kai: please try this patch which (I think) will support case-insensitive matches in MongoDB:

4767a79

The "" convention is the same (e.g. {matches, "DOG"})

@kotedo
@LordIvan

the case insensitive mnesia matches worked a treat. Brilliant, thanks!

@evanmiller evanmiller closed this Jan 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment