Michael Holzt <[EMAIL PROTECTED]> wrote:

> > I don't understand what problem you and Michael are trying to 
> > solve with the messages after this one.  What doesn't match?
> 
> The old code did not match for single character sub-domains.

I understand that.  I was talking about the initially proposed 
fix, which was this:

my $subdomain = '(?:[a-zA-Z0-9](?:[-a-zA-Z0-9]*[a-zA-Z0-9])?)';

> Oh, [alternations and look-aheads] are there for a reason: Because
> without them we would match too much, e.g. illegal subdomains. A
> subdomain can not start or end with a hyphen, and to ensure this,
> complicated regexps like posted are needed. 

The first fix (the line above, not the original code) does not 
allow hyphens at the beginning or end, and it does allow single-
character subdomains.  It has no alternations or look-aheads.  
I still don't see what the further complication is adding, 
though I suppose if it ends up being an equivalent regex it 
doesn't matter much (except that it makes the code harder to 
follow).

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Washington, DC

Reply via email to