I'm trying to extract the resource group name in Azure via az cli.
The full path to a certain resource group looks like this:
/subscriptions/b049-1234-1256-125456-125/resourceGroups/Test_ResourceGroup
I'm trying to only extract "Test_ResourceGroup" out of the full string (which is stored in a variable), so i think the code would be something like
$scope = /subscriptions/b049-1234-1256-125456-125/resourceGroups/Test_ResourceGroup
$resourcegroup = $scope -match 'regex'
But I'm terrible at regex and not great at it. The addition challenge is that sometimes there's more strings or integers after the resource name, e.g.
/subscriptions/b049-1234-1256-125456-125/resourceGroups/Test_ResourceGroup/specificnameofresource/blahblah
But again, I just want the resource group name.