You can always query that regex with the path: option, using the path of your current file, but that’s a bit hacky.
You could also automate this using the Templater plugin to take the regex as an input and build a query block at the end of the file, computing automatically the current file path I guess ?