• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

about patten matching in perl

i wanna filter web URL from a file

and the pattern of URL is
----------------------------------------
http://xxxxxxxxxxxxxxxxxxx.jpg


example
http://img2.photo.163.com/lxx17385/542900/4366225.jpg
http://www.yoto.com/fff.jpg

-------------------------------------------

i then tried this code

while ($line = <FILE>) {
  if ($line =~ m/(http:\/+*jpg)/g) {
    print $1."\n";
      print "line: $j -> ", $line, "\n";
      $j++;
  }
 
}

however,, there is error i don't know how to fix

any suggestion?
Tom
0
tom_mk
Asked:
tom_mk
1 Solution
 
ozoCommented:
while( $line =~ m/(http:\/.*?jpg)/g ){
    print $1."\n";
     print "line: $j -> ", $line, "\n";
     $j++;
}
0
 
tom_mkAuthor Commented:
thx man
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now