Scrape Analytics ID

I would like to display the Analytics ID from a page (gramofon.com). The regex looks like this: 'UA[^']++'.

Unfortunately I can't get the Excel formula right. The result should be UA-51025928-1.

Have you tried this one?
https://seotoolsforexcel.com/googleanalyticsid/

Since I need the same function for the Google Tag manager, I need a different solution.

Regex: 'GTM;[^']++'.

Example Google Tag Manger page:

www.home24.de

here GTM-KGG74VH should be displayed.

This one works for me:
=RegexpFindOnUrl(A1;"id=(gtm-\w+)";1)

Assuming the code only have letters and numbers. and exists in the id attribute.

Thank you!