Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can use the following regular expressions separately or by combining them in a joint OR expression.</p> <pre><code>ValidIpAddressRegex = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"; ValidHostnameRegex = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$"; </code></pre> <p><strong>ValidIpAddressRegex</strong> matches valid IP addresses and <strong>ValidHostnameRegex</strong> valid host names. Depending on the language you use \ could have to be escaped with \.</p> <hr> <p><strong>ValidHostnameRegex</strong> is valid as per <a href="http://tools.ietf.org/html/rfc1123" rel="noreferrer">RFC 1123</a>. Originally, <a href="http://tools.ietf.org/html/rfc952" rel="noreferrer">RFC 952</a> specified that hostname segments could not start with a digit.</p> <p><a href="http://en.wikipedia.org/wiki/Hostname" rel="noreferrer">http://en.wikipedia.org/wiki/Hostname</a></p> <blockquote> <p>The original specification of hostnames in <a href="http://tools.ietf.org/html/rfc952" rel="noreferrer">RFC 952</a>, mandated that labels could not start with a digit or with a hyphen, and must not end with a hyphen. However, a subsequent specification (<a href="http://tools.ietf.org/html/rfc1123" rel="noreferrer">RFC 1123</a>) permitted hostname labels to start with digits.</p> </blockquote> <pre><code>Valid952HostnameRegex = "^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$"; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload