[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:       Carsten Niehaus <cniehaus () gmx ! de>
Date:       2002-08-18 10:43:45
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 18 August 2002 04:10, Richard Garand wrote:
> On August 17, 2002 02:32 pm, Carsten Niehaus wrote:
> > But this is not working for eg www.kde.de. What is the most intelligent
> > way to hadle this problem? The is QHostAddress but this is only for IPv4
> > and IPv6 (takes only IPs (uint)).
>
> How about using "^(\\w{1,256})+\\.([a-z]{2,6})$" (added the +)? That would
> allow an unlimited number of subdomains before the top-level domain.

No, it does not. This is how I check:

bool Testforkmf::checkFQHN( QString inp )
{
    bool valid = true;
    QString blah = inp;
    testFQHN = inp;
    kdDebug() << testFQHN << endl;

    //QRegExp exp("^(\\w{1,256})\\.([a-z]{2,6})$", false);
    QRegExp exp("^(\\w{1,256})+\\.([a-z]{2,6})$", false);
    if (inp.contains( exp )) valid = TRUE;
    else valid = false;

    if ( valid ) led->setColor( Qt::green );
    else led->setColor( Qt::red );

    return valid;
};

In this testcase kde.de works but www.kde.de does not.

Carsten

- -- 
Anyone can hold the helm when the sea is calm.
		-- Publius Syrus
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9X3pj29GaGyAowFcRAs0AAKCkVE7IL1YrOo7IMjm5S0zfEFEPDQCfR22x
hYvwC3P6Ml9g9wXQqoQ71Vk=
=H3Lp
-----END PGP SIGNATURE-----


>> 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