Thanks for the small tutorial - but I must admit that I can only see
(according to your explanation) the regex to be matching anything except
a dot. So substituting them should return only 1 or more dots. But that
isn't what we get here.  You're by saying that the dot in a class is not
a special qualifier.

Oh! How I wish I could understand it. :-) I think I need to go back to
learn some more regexs.


||> -----Original Message-----
||> From: Wiggins d Anconia [mailto:[EMAIL PROTECTED]
||> Sent: Friday, April 16, 2004 5:40 PM
||> To: B. Fongo; [EMAIL PROTECTED]
||> Subject: Re: What exactly is this simple regex doing?
||> 
||> Please bottom post....
||> 
||> >
||> > This regex by Rob is working alright, but can't follow exactly how
it
||> > truncates an absolute url from first character to the one before
the
||> > dot.
||> >
||> > It returns (.domain4you.com from http:://www. domain4you.com.)
exactly
||> > what is expected, but I can't easily understand it.
||> >
||> > Please I'm not pulling anyone's leg. So just explain it if you
can.
||> >
||> >  (.domain4you.com from http:://www. domain4you.com.)
||> >
||> >
||> > foreach (@domains) {
||> >   my $name = $_;
||> >   $name =~ s/^[^\.]+//;
||> >   print $name;
||> > }
||> 
||> The initial ^ says to start matching at the beginning of the string.
||> 
||> [] defines a character class, so we are going to match against
||> characters in the class.
||> 
||> In this case the ^ *because it is the first character* of the class
||> causes the class to be negated, aka we are going to match any
character
||> *not* in the class.  The class is a \ and a . though I suspect that
||> should just be a . because I believe dot inside a class is not
special.
||> 
||> The + says one or more of the characters matched by the class.
||> 
||> So it is really saying match one or more characters that are not a
dot
||> starting at the beginning of the string.  Or, match everything up
until
||> the first dot.
||> 
||> http://danconia.org



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to