regexp problem in grabbing link url

Discussion in 'PHP' started by 2beers, Mar 10, 2009.

  1. #1
    Hi.
    So i have to grab a cetain part from a link.

    Here is my example:
    so I want to grabb the red text using preg_match function.

    My problem is that i don't know how to put the condition if &y=23 exists or not.

    please help

    Thank you
     
    2beers, Mar 10, 2009 IP
  2. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #2
    How about:

    preg_match('/<a href="somepage.cgi?x=([^&"]+)/i', ...
    Code (markup):
     
    SmallPotatoes, Mar 10, 2009 IP
  3. 2beers

    2beers Well-Known Member

    Messages:
    195
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Thanks . That is great
     
    2beers, Mar 10, 2009 IP