How can I match labels or strings within `where()` using regex?

Thanks to both of you! The reason I need to use something like regex is because this code is going in a template, which I use with Quarto (as a “template partial”), and has to be applicable to a range of reports.

I am not the one generating the Markdown, and I want to add as little to the Markdown as possible. (I’m not the one generating the .qmd files. It’s hard enough to get the copy editor to produce Markdown with Pandoc @citations, but it’d be impossible to get them to add Typst code in it as well.)

I should hasten to add that the labels under each heading are auto-generated by Pandoc/Quarto when it creates the intermediate .typ file.