preg_match_all and help with regex, I can't get it?

Discussion in 'PHP' started by cgchris99, Oct 17, 2006.

  1. #1
    I'm trying to pull out a piece of javascript from a loaded web page using a regex command.

    Here is what the html code looks like.
    --------------------------------------
    more code here blah blah....
    function Update()
    {
    theForm["updateForm"].value = 'Updating';
    theForm.action = 'browse.aspx?myaction=1234567890';
    }

    function LoadImage()........
    more code here blah blah
    ----------------------------------------
    Here is how I am trying to find this update routine
    preg_match_all("#function Update(.*?)function LoadImage#s", $var,$myaction)

    This fails to produce any matches. I think it is because of the multiple lines.

    Can anyone help me with this?
     
    cgchris99, Oct 17, 2006 IP
  2. cgchris99

    cgchris99 Peon

    Messages:
    234
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I figured it out myself... here is how I changed the code
    (?s)function Update(.*?)function LoadImage

    Sorry and thanks anyway.
     
    cgchris99, Oct 17, 2006 IP