Liquid, where filter with contains operator

We can use this one.

{% for product in collection.products | where "vendor", "my_vendor" %}

I would like to filter products by their tags. but as you know, product has multiple tags.

Then how do I filter collection’s products by specific filter?

for example, I have product A, B and product A has tags as “Tag1, Tag2”, also product B has “Tag2, Tag3”.

I would like to show the products of collection, that has only Tag3, which means I would like to show only product B.

I can create the collection by product tags.
But it’s better to use the filter for our business logic.

Please help me out!

Thanks

It won’t work with tag, but shopify has updated filter, you can learn about it, it will work much better.
Refer https://shopify.dev/themes/navigation-search/filtering
Code: https://github.com/Shopify/dawn/blob/main/sections/main-collection-product-grid.liquid
Hope it helps!