diff --git a/giturlparse/parser.py b/giturlparse/parser.py index 62959a7..78540c9 100644 --- a/giturlparse/parser.py +++ b/giturlparse/parser.py @@ -37,12 +37,11 @@ POSSIBLE_REGEXES = ( re.compile(r'^(?Phttps?|git|ssh|rsync)\://' - r'(?:(?P.+)@)*' - r'(?P[a-z0-9_.-]*)' - r'[:/]*' - r'(?P[\d]+){0,1}' - r'(?P\/((?P[\w\-]+)\/)?' - r'((?P[\w\-\.]+?)(\.git|\/)?)?)$'), + r'(?:(?P[^@]+)@)?' + r'(?P[^\/:]+)' + r'(:?(?P\d+))?' + r'(?P\/((?P[\w\-\.\/]+)\/)?' + r'(?P[^\/]+?)(\.git|\/)?)$'), re.compile(r'(git\+)?' r'((?P\w+)://)' r'((?P\w+)@)?' diff --git a/test/conftest.py b/test/conftest.py index 0315071..eca664c 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -315,6 +315,18 @@ def first_match_urls(): 'name': 'Stouts.openvpn', 'owner': 'tterranigma', }, + 'ssh://someserver.com/tfs/SomeWhere/My.Project/_git/somerepo': { + 'pathname': '/tfs/SomeWhere/My.Project/_git/somerepo', + 'protocols': ['ssh'], + 'protocol': 'ssh', + 'href': + 'ssh://someserver.com/tfs/SomeWhere/My.Project/_git/somerepo', + 'resource': 'someserver.com', + 'user': None, + 'port': None, + 'name': 'somerepo', + 'owner': 'tfs/SomeWhere/My.Project/_git', + }, }