Reputation: 2189
I am trying to get a column that has an exact word say yax and not yaxx but I keep getting the two for whichever one that search for. I want only yax when I search for yax regardless of case.
I have tried:
key = 'yax'
query = Model.objects.filter(content__iregex=r"[[:<:]]*{0}*[[:>:]]".format(key))
Answers I have checked but didn't quite help me:
Upvotes: 0
Views: 533
Reputation: 174816
Remove the *
from your regex.
query = Model.objects.filter(content__iregex=r"[[:<:]]{0}[[:>:]]".format(key))
Upvotes: 1