      # Host patterns
      hostname_re = r'[a-z' + ul + r'0-9](?:[a-z' + ul + r'0-9-]{0,61}[a-z' + ul + r'0-9])?'
      # Max length for domain name labels is 63 characters per RFC 1034 sec. 3.1
      domain_re = r'(?:\.(?!-)[a-z' + ul + r'0-9-]{1,63}(?<!-))*'
      tld_re = r'\.(?:[a-z' + ul + r']{2,63}|xn--[a-z0-9]{1,59})\.?'
      host_re = '(' + hostname_re + domain_re + tld_re + '|localhost)'
  
      regex = _lazy_re_compile(
          r'^(?:[a-z0-9\.\-\+]*)://'  # scheme is validated separately
          r'(?:\S+(?::\S*)?@)?'  # user:pass authentication
 
</s> remove http://invalid.c-m
 </s> add http://invalid.-com
    tld_re = (
        '\.'                                # dot
        '(?!-)'                             # can't start with a dash
        '(?:[a-z' + ul + '-]{2,63}'         # domain label
        '|xn--[a-z0-9]{1,59})'              # or punycode label
        '(?<!-)'                            # can't end with a dash
        '\.?'                               # may have a trailing dot
    )
      # Host patterns
      hostname_re = r'[a-z' + ul + r'0-9](?:[a-z' + ul + r'0-9-]{0,61}[a-z' + ul + r'0-9])?'
      # Max length for domain name labels is 63 characters per RFC 1034 sec. 3.1
      domain_re = r'(?:\.(?!-)[a-z' + ul + r'0-9-]{1,63}(?<!-))*'
    tld_re = (
        '\.'                                # dot
        '(?!-)'                             # can't start with a dash
        '(?:[a-z' + ul + '-]{2,63}'         # domain label
        '|xn--[a-z0-9]{1,59})'              # or punycode label
        '(?<!-)'                            # can't end with a dash
        '\.?'                               # may have a trailing dot
    )
      host_re = '(' + hostname_re + domain_re + tld_re + '|localhost)'
  
      regex = _lazy_re_compile(
          r'^(?:[a-z0-9\.\-\+]*)://'  # scheme is validated separately
          r'(?:\S+(?::\S*)?@)?'  # user:pass authentication
keep keep keep keep replace keep keep keep keep keep
 Fixed #26204 -- Reallowed dashes in top-level domains for URLValidator.

Thanks Shai Berger for the review. 
django/core/validators.py