[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: how to validate if a QString contains a FQNH?
From: Fritz Elfert <felfert () to ! com>
Date: 2002-08-19 16:25:01
[Download RAW message or body]
On Monday 19 August 2002 14:34, Richard Garand wrote:
> On August 19, 2002 12:34 am, Rolf C. R. wrote:
> > On Sunday 18 August 2002 22:49, Richard Garand wrote:
> > > Oops, made a mistake.. it should be "^(\\w{1,256}\\.)+([a-z]{2,6})$"
> >
> > this will still not work with domains like 'www.t-online.de', because
> > '-' is not a member of '\w'.
>
> In that case you could change \w to [[:word:]-], but that gives a basic
> idea of how to allow multiple subdomains.
Just my 2c:
- Single name components are restricted to 64 characters including the dot
so the first range spec should be {1,63}, not {1,256}. The _whole_ string
may be up to 256 chars (from RFC 1035).
- Although it is technically possible, RFC 1035 also strongly recommends that
name components do start with a character only (no digit, no dash).
- Finally (and this is really silly in the above expression), the last
name component does not have any specific length restriction. For example
a customer is using .intranet as his internal toplevel domain which is
perfectly legal and would be rejected by the above expr.
-> A better regexp would be:
"([a-z][\\w\\-]{0,62}\\.)+([a-z][\\w\\-]{0,62})$"
and in addition, the length should be verified to be at most 256.
Ciao
-Fritz
--
Fritz Elfert <felfert AT to DOT com> Thinking Objects Software GmbH
--------------------------------------------------------------------------
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic