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