Reputation: 37886
MyModel.objects.filter(
Q(title__iregex=r'.{10,}.*') |
Q(title__iregex=r'.*[0-9].*') |
Q(title__iregex=r'\s+')
)
I am getting all objects whose titles are longer than 10
or whose titles contain at least one number
.
but the Q(title__iregex=r'\s+')
is failing which should return objects whose titles contain at least one whitespace. what am I doing wrong?
I tried:
r'[\\s+]'
r'.*[\\s+].*'
r'\\s+'
r'[:space:]'
no sign of success.
I am using MySQL btw
Upvotes: 1
Views: 1540
Reputation: 37886
ok problem solved. Since MySQL POSIX Regex uses, I needed:
Q(answer__iregex=r'[[:space:]]')
Upvotes: 3