need regular expression to match image file, please help.

Discussion in 'Programming' started by feelexit, Jun 30, 2009.

  1. #1
    $re = '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i';

    I am using this regular expression to match all image files, now i need to filter based on domain name. for example, i want to get all images contain "yahoo.com".

    http://yahoo.com/image/1.jpg

    I rewrote this RE, but its working. please help me out.
    $re = '/<img.+src=[\'"]([^\'"]+)(yahoo.com)([^\'"]+)[\'"].*>/i';
     
    feelexit, Jun 30, 2009 IP
  2. Ornani

    Ornani Greenhorn

    Messages:
    66
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #2
    first, try regexpal
    second:
    $re = '/<img\s+src=[\'"]([^\'"]+)(yahoo\.com)([^\'"]+)[\'"].*?>/i';
     
    Ornani, Jul 1, 2009 IP