Querry Influx IP Adress filter third octet

Hi everybody,
i like to do a variable witch filters the result by IP Adress but only in the thrid octet.
For Example the Querry give back:

10.10.1.5
10.10.2.6
10.10.7.8
172.16.1.9
172.16.2.4
172.16.7.54

Than i like to have a Variable that contains for Example ..2.* so i get the result from all IPs matching this pattern. is this posible?
Thanks in Advanced
Matze

Are you using flux or influxql? maybe leverage the filter by regex? not my forte

or another approach drop downs

Hi i´m useing InfluxDB not Flux

Influxdb is a time series database. You can query the data 2 ways

Influxql
Flux

Which one are you using and could you show us how you are doing it?

i think i use Influxql