Re: RE: Regex to match valid host or dns names

2004-10-14 Thread perl
Your regex did not allow (w2k-server-proxy2) a valid dns name. I now see how complex it is to match valid ips or dns names. The more I try to modify the regex to perfection, the more I see hopholes. So I think it is not worthwhile spending lot of time on this regex. My script does more than patte

RE: Regex to match valid host or dns names

2004-10-13 Thread K.Prabakar
On Thu, 14 Oct 2004, K.Prabakar wrote: > On Wed, 13 Oct 2004, Babale Fongo wrote: > > > K.Prabakar's suggestion looks good but also failed the test: > > > > "$_ =~ /^\w\w*-?\w+?[\.\w\w*-?\w+?]*$/", > > > > It will match an invalid dns name like this (host-.domain.com) as a valid. > > I'm stil

Re: Regex to match valid host or dns names

2004-10-13 Thread Dan Jones
On Wed, 2004-10-13 at 15:06, K.Prabakar wrote: > > example below, it fails to match "host-no.top-level" as a valid host > > name. I modify the regex several times - but still don't get the right > > outlook. > > > > my @hosts = qw(192.168.22.1 192.168.22.18 localhost another.host.domain > > host-n

RE: Regex to match valid host or dns names

2004-10-13 Thread Wiggins d Anconia
> Hi, > > My original regex to match ips is this: > "$_ =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}/;", which is ok. But matching dns name > is still a problem. > For some definitions of "ok". Seen an IP like: 987.654.321.0 ?? Or how about, 255.255.255.255.1.3.4.5.6 ?? I am assuming you had at least fou

RE: Regex to match valid host or dns names

2004-10-13 Thread Babale Fongo
ROTECTED] ||Subject: Re: Regex to match valid host or dns names || ||> ||>> example below, it fails to match "host-no.top-level" as a valid host ||>> name. I modify the regex several times - but still don't get the ||>> right ||>> outlook. ||>> ||&

Re: Regex to match valid host or dns names

2004-10-13 Thread Randal L. Schwartz
> "K" == K Prabakar <[EMAIL PROTECTED]> writes: K> Try this > $_ =~ /^\w\w*-?\w+?[\.\w\w*-?\w+?]*$/ "Try" is usually a good clue to mean "This is not your solution". In this case, you've got all sorts of stuff going on in a character class. Wrong stuff. "Try" again. Please. -- Randal

Re: Regex to match valid host or dns names

2004-10-13 Thread Randal L. Schwartz
> "Steve" == Steve Bertrand <[EMAIL PROTECTED]> writes: Steve> I'm just beginning to learn a bit about some of the more obscure Steve> regex's, but I'd like to ask if this following regex would ensure no Steve> IP's got trapped in the @dns array? (Assuming that no .tld ends in a Steve> \d): S

Re: Regex to match valid host or dns names

2004-10-13 Thread Steve Bertrand
> >> example below, it fails to match "host-no.top-level" as a valid host >> name. I modify the regex several times - but still don't get the >> right >> outlook. >> >> my @hosts = qw(192.168.22.1 192.168.22.18 localhost >> another.host.domain >> host-no.top-level my.host.domain.com); >> foreach (@

Re: Regex to match valid host or dns names

2004-10-13 Thread K.Prabakar
> example below, it fails to match "host-no.top-level" as a valid host > name. I modify the regex several times - but still don't get the right > outlook. > > my @hosts = qw(192.168.22.1 192.168.22.18 localhost another.host.domain > host-no.top-level my.host.domain.com); > foreach (@hosts){ >