Replace instance label with regex

I'm trying to replace the instance label of a given job. I understand that I can do this with the relabel_config. But I struggle with the regex and regex replace stuff.

My targets have an obscure target url like There are reasons why I can't change these, so I need to do some relabeling.

This is my current config:

  - source_labels: [__address__]
    target_label: instance
    regex: ^test.*
    replacement: server

But this relabels the url to server. What's my mistake?