using JuMP
m = Model()
@variable(m, x[1:3])
@variable(m, y[1:5])
v = all_variables(m)

v is an 8-element Vector{VariableRef}. Now I want to extract all the indices with respect to variable y from the vector v (e.g., it can be a Vector{Int64}: [4:8;]). How should I do?