Hi @josepturon,
Can you share a bit more details about that naming convention? Do the groups for example always start with a certain set with characters?
In that format you could probably use a List Groups Graph API call with a $filter query parameter and a startswith.
For the members you can use an $expand query parameter.
https://graph.microsoft.com/v1.0/groups?$filter=startswith(displayName,'contoso')&$expand=members