RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 2
Title Test Details Pattern Title
Expression
(?=^.{1,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)
Description
Validates MS FQDNs. 1) Entire fqdn less than 255 chars. 2) Host and domain names may contain an underscore. 3) 1st char can be a number. 4) No part can be all numbers. 5) Allows any TLD Works in C#. Based on Remi Sabourin's regex
Matches
host.domain.com | _host.domain.com | 1host-2._ldap.domain.com
Non-Matches
33.domain.com | host..com | this_really_long._fully_qualified_domain_name._contains_257_characters_w
Author Rating: Not yet rated. Scott Mulcahy
Title Test Details Pattern Title
Expression
(?=^.{1,254}$)(^(?:[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]\.?)+(?:[a-zA-Z]{2,})$)
Description
Based on Remi Sabourin pattern. Adds total length validation. Like Remi's this allows a part to be all numbers. To prevent all numbers just add (?!\d+\.) between (^(?: and ([a-z-A-Z0-9]
Matches
host.domain-name.com | 33.domain.com | 3-3.domain.com
Non-Matches
_host.domain.com | [host].domain.com | host.domain.33
Author Rating: Not yet rated. Scott Mulcahy
   Displaying page 1 of 1 pages; Items 1 to 2

Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials