import re


def parse_remote_url(url):
    """Extract user, repo from URL."""
    repo_urls = [
        'https://gitlab.audeering.com/',
        'http://gitlab.audeering.local/',
        'http://gitlab2.audeering.local/',
        'git@srv-app-01.audeering.local:',
        r'^.*@gitlab.audeering.com/',
        'https://github.com/',
        'git@github.com:',
    ]
    for repo_url in repo_urls:
        url = re.sub(repo_url, '', url)
    url_parts = url.split('/')
    repo = url_parts[-1]
    user = '/'.join(url_parts[:-1])
    if repo.endswith('.git'):
        repo = repo[:-4]
    return (user, repo)