Range of values in Custom variable

Hi there!
I have encountered some difficulties in building a dashboard for Elasticsearch. I can’t understand how to save a range of values in a variable. Here is my query:
_index: "nginx-access-" AND response: $response_code AND …"*.

My variable $response_code is of type Custom. If its value is success : 200, error : 500 - no problem, the dashboard is built. But how do I use such values: {200 TO 400} or 2xx?
I have already tried all possible variants that came to my mind, read a lot of examples, but I haven’t found a solution.
Could you please tell me if this is possible?