Django uses "search" rather than "match" for the _regex option. If you want match, make sure the regex starts with a ^
On Monday, December 17, 2012 6:55:09 PM UTC-8, Beni wrote:
Hi,
I'm getting stuck on figuring out why regex searches are matching any part of a field when I use my model's regexp filter (instead of matching linearly); they're behaving like calls to re.search instead of re.match.
Since I'm using Sqlite, I registered my own function based on Python's re.match. I tried testing the function in a shell by directly connecting to the database to search the field and comparing those results to using the model's regexp filter. The filter returns significantly more items and when I test to see if they are strict matches for the regexp the 'extra' ones fail.
I'm attaching a transcript of the shell tests.
Any insight or advice would be greatly appreciated.
Beni