MCPcopy
hub / github.com/pydantic/pydantic / ascii_domain_regex

Function ascii_domain_regex

pydantic/v1/networks.py:141–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

139
140
141def ascii_domain_regex() -> Pattern[str]:
142 global _ascii_domain_regex_cache
143 if _ascii_domain_regex_cache is None:
144 ascii_chunk = r'[_0-9a-z](?:[-_0-9a-z]{0,61}[_0-9a-z])?'
145 ascii_domain_ending = r'(?P<tld>\.[a-z]{2,63})?\.?'
146 _ascii_domain_regex_cache = re.compile(
147 fr'(?:{ascii_chunk}\.)*?{ascii_chunk}{ascii_domain_ending}', re.IGNORECASE
148 )
149 return _ascii_domain_regex_cache
150
151
152def int_domain_regex() -> Pattern[str]:

Callers 1

validate_hostMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected