Accessing findRE named capture groups

I’m translating some logic from javascript to hugo, and I hit a bit of a speedbump.

How can I access my named capture groups in a findRE? I know I haven’t nailed the regex yet, but I need to know this part first. I have two named groups at the moment: name and file. How can I access these? $result returns an array it seems, but no subgroups. They don’t have to be named, if that helps…

My regex looks like this:

{{ $results := findRE `~~(?P<name>\S*)\n(?P<file>[\s\S]*?)(?:~~|$)` .Inner }}

The string looks like this:

<h1>Random header</h1>
Random content
h1 { font-size: 80px; }