# Pattern match SubValues with unspecified number of arguments

Does there exist a single pattern that would match SubValues of arbitrary "length" with a given head? For example, I would like to match all of the following

f[x]
f[x][y]
f[x][y][z]
f[x][y][z][w]
...

• This question has been asked before on Stack Overflow. I can't mark it as a duplicate because that's a separate site, but otherwise it is a duplicate. You can find solutions to your question there. Jul 12, 2020 at 16:14
• Thanks, I'll close the question Jul 12, 2020 at 16:17
• Please don't close it. Others with this question who come to this site, will see it and a reference to the other one. Thanks. Jul 12, 2020 at 16:17