# for username: # Username may only contain alphanumeric characters or single hyphens, and cannot begin or end with a hyphen # for repo url: # any valid alphanumeric including underscores import re def validate_repo_url(value): reg = re.compile('^([a-zA-Z\d]{1}[-a-zA-Z\d]+)(/){1}([\-\w]+)$')