Compare two labels, drop if they are not the same

I have an application that has a lot of useless metrics that I want to weed out before scraping.

The metrics that are useless have label_one and label_two that do not match.

metric_to_keep{ label_one="identical-value",  label_two="identical-value" }
metric_to_drop{ label_one="different-value",  label_two="value-is-different" }

I thought I had a great solution by using this bit of regex:

- source_labels: [label1, label2]
  action: drop
  regex: ^(.+);\1

However, apparently: \1 backreference (NOT SUPPORTED)

error parsing regexp: invalid escape sequence: `\\1`

Is there a way for me to accomplish this task?

I was able to implement the ideal solution, which was to update the application that was sending the metrics. The application no longer exports the useless metrics. In this situation I was lucky to have access to the code of the application being scraped, this is not always the case.