Possible to query folders matching a string using FROM?

I couldn’t find anything on this topic. And don’t know how to approach it.
I see that there’s:
https://blacksmithgu.github.io/obsidian-dataview/query/functions/#regexmatchpattern-string

But am not sure where to start.

You can’t use variables in FROM.
Instead, you can use filters in WHERE with functions/variables…