2

I've noticed that the * wildcard works for simple custom field queries, for example if I have three entries named Foo, Foo*, Foo*Bar, running

craft.entries.title('Foo*').all()

will get 3 results, and if I dump the raw SQL there's a LIKE% statement. Is there a way to disable this behavior and query for an exact match? I could filter the results with firstWhere() or similar, but it seems like an unexpected behavior.

1 Answer 1

1

Turns out asterisks can be escaped with a double slash, so you can query

craft.entries.title('Foo\\*').all()

and it will match Foo*

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.