--- [EMAIL PROTECTED] wrote:
> i have a basic knowledge of regex but i want to know if there is a
> simpler way to pull patterns out of a line.
>
> if i have a line like:
>
> here is a sample with 123.456.123.456 in the middle.
>
> m/\d\.\d\.\d\.\d/ will match the entire line. is there an easy way to
> get only the ip address?
m/\d\.\d\.\d\.\d/ won't match on this line at all.
try something like:
my($ip) = $line =~ /(\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?)/;
that allows for 1,2,or 3 digit segments, dot seperated.
__________________________________________________
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/