Need a php pattern (preg_match) to extract all css file

Discussion in 'PHP' started by samirkumardas, Jul 20, 2008.

  1. #1
    I need to extract all css file location from a file using preg_match_all etc.

    <link rel="stylesheet" href="css/main.css" type="text/css">


    If there are link like above, i need the css file name. Here the output will be the "css/main.css"

    Thanks
     
    samirkumardas, Jul 20, 2008 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    preg_match('/<link rel="stylesheet" href="(.*?)" type="text\/css">/',$data,$output_array);
     
    matthewrobertbell, Jul 20, 2008 IP
  3. samirkumardas

    samirkumardas Banned

    Messages:
    123
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi Tauren,

    It worked!!

    Thank you very much
     
    samirkumardas, Jul 20, 2008 IP