1

Given a string, is there a build-in way to check if that string is a valid subdomain according to standards like RFC 1035, RFC 1123, and RFC 2181? I would very much like to avoid having to write my own regex for the purpose.

Mikkel R. Lund
  • 2,336
  • 1
  • 31
  • 44
  • I once was recommended to try throwing it into one of the [Uri CTOR](https://learn.microsoft.com/en-us/dotnet/api/system.uri.-ctor?view=netframework-4.8#System_Uri__ctor_System_String_) overloads. Not sure if this covers your requirements. – Fildor Nov 12 '19 at 08:53
  • You can take a look at https://stackoverflow.com/questions/11809631/fully-qualified-domain-name-validation – Yuri Ginsburg Nov 12 '19 at 08:56
  • Does this answer your question? [Fully qualified domain name validation](https://stackoverflow.com/questions/11809631/fully-qualified-domain-name-validation) – Ian Kemp Nov 12 '19 at 11:38
  • You need to define "valid" in your context. If it is only syntax wise, you need to find a DNS library in your programming language, and it should have such thing by default. – Patrick Mevzek Nov 12 '19 at 20:29

0 Answers0