Need Regex help

Discussion in 'PHP' started by tamilsoft, Dec 20, 2007.

  1. #1
    Hi,

    I want to extract the following field's value[ie, http://www.example.com from the following example] from a web page:



    html codes...................
    <input type="hidden" name="url" value="http://www.example.com">
    html codes.................
     
    tamilsoft, Dec 20, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    preg_match('~<input\s+type="hidden"\s+name="url"\s+value="([^"]+)">~', $text, $match);
    
    echo $match[1];
    
    PHP:
     
    nico_swd, Dec 20, 2007 IP
    tamilsoft likes this.
  3. tamilsoft

    tamilsoft Banned

    Messages:
    1,155
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks man It's working............
     
    tamilsoft, Dec 20, 2007 IP