0

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:

  1. This...
  2. And this...
  3. And this too...
Community
  • 1
  • 1
Yax
  • 2,127
  • 5
  • 27
  • 53

1 Answers1

1

Remove the * from your regex.

query = Model.objects.filter(content__iregex=r"[[:<:]]{0}[[:>:]]".format(key))
Avinash Raj
  • 172,303
  • 28
  • 230
  • 274