Find all Params Matching a Pattern

I want to find all parameters matching a pattern. The parameters can be like imgXxY which points to the respective image size. Some sizes may not be set. I need to retrieve the part which is changes also, e.g., 16x16, 32x32, 48x48, 64x64, etc. X and Y can be of any value so it is not feasible to check many parameters combination out of which many might not be set. I need to iterate over what is set. This involves:

  • filter all Param names which match a pattern, i.e., Params which have “img”
  • retrieve the encoded part, i.e., figure out what X and Y in XxY
  • iterate over the resulting list generating code.