Making more specific queries match more specific things, with regard to punctuation

How would you use elasticsearch such that if a punctuation character is present in a query, the query matches only if that character is present in the document. However, if the punctuation character is not present in the query, it would always match.

For example, with a document, these queries would match: "", "discuss elastic co".

And with a document discuss elastic co, only this query would match: "discuss elastic co". The query "" would not match because the document doesn't have the dots.

This makes more specific queries match more specific things.

Is it possible to do that with builtin tokenizers or existing plugins ?