msiemens/tinydb

Propose new Query method similar to re.search()

wearp opened this issue · 3 comments

Query.matches(), which uses re.match, searches from beginning of field value. I propose a new feature that mirrors python's re.search and allows matching inside field value, not just a beginning.

Perhaps this could be done by additional parameter to QueryRegex (something like re_method) to distinguish between Query.matches() and Query.search.

I can submit pull request if ready?

Sounds reasonable to me. Pull requests are welcome :)

I renamed it to Query.contains. That way it matches Query.matches better and reads nicer:

where('field').contains('regex')

That's cool. Makes more sense. I thought about it at first but saw there was another function with same name. Been away on holidays - only just checked emails.

Sent from my iPhone

On 14 Oct 2014, at 17:41, Markus Siemens notifications@github.com wrote:

I renamed it to Query.contains to better match Query.matches. That way it reads nicer:

where('field').contains('regex')

Reply to this email directly or view it on GitHub.