Article View: de.comp.lang.php
Article #25Re: Validate Domain Name
From: brez
Date: Sun, 02 Jul 2000 00:00
Date: Sun, 02 Jul 2000 00:00
34 lines
1702 bytes
1702 bytes
I looks to me that you're only checking a single char. you need the '+' sign
in other words for multiple chars:
matches patterns with any number of these characters:
[a-zA-Z0-9\.\-]+
matches everything but those charaters:
[^a-zA-Z0-9\.\-]+
also you need to use the escape character with periods and dashes (i.e
'\.')
>How i can to validate a domain name that only must contain this characters
>"abcdefghijkmnpqrstuvwxyz2345678910ABCDEFGHIJKLMNOPQRSTUVWXYZ.-" ?
>
>I tried this but it doesn't work.
>
> if
>(ereg('[^abcdefghijkmnpqrstuvwxyz2345678910ABCDEFGHIJKLMNOPQRSTUVWXYZ.-]',
>$domain)){
> $ok = "False";
> }
>
> if (eregi('[^-.a-z0-9A-Z]', $domain)){
> $ok = "False";
> }
>
>Help me, please.
>
>Thank You. Jose Luis
>
>
>
>
Technical Details
Message-ID:
<l7E75.44817$T9.344294@news1.rdc1.sdca.home.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8jhse0$p0o$1@talia.mad.ttd.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10f92b,4026a23bcd365605 X-Google-Attributes: gid10f92b,public X-Google-Thread: 10ce1c,4026a23bcd365605 X-Google-Attributes: gid10ce1c,public X-Google-Thread: 10b1d3,4026a23bcd365605 X-Google-Attributes: gid10b1d3,public X-Google-Thread: 1148a8,4026a23bcd365605 X-Google-Attributes: gid1148a8,public From: "brez" <spamsux@joemomma.com> Subject: Re: Validate Domain Name Date: 2000/07/02 Message-ID: <l7E75.44817$T9.344294@news1.rdc1.sdca.home.com> X-Deja-AN: 641439981 References: <8jhse0$p0o$1@talia.mad.ttd.net> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 X-Complaints-To: abuse@home.net X-Trace: news1.rdc1.sdca.home.com 962530897 24.0.186.48 (Sun, 02 Jul 2000 02:41:37 PDT) Organization: @Home Network NNTP-Posting-Date: Sun, 02 Jul 2000 02:41:37 PDT Newsgroups: de.comp.lang.php,ba.php,fr.comp.infosystemes.www.auteurs.php,ufra.lists.php