Regex to match space and a string until a forward slash,regexp = re.compile('^group/(?P<group>[^/]+)/users/(?P<user>[^/]+)$')