Help with extracting please folks.!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kirill_uk@hotmail.com

    Help with extracting please folks.!

    Help with extracting please folks.!
    Hi. I have this:
    a variable like: <a href="http://www.some_html.c om/text.html" >some
    text</a><br>

    I heed to extract the "http://www.some_html.c om/text.html " and put
    it in var "link"
    And extract "some text" and put it var "text",.

    So basically extract all between <a href=" and " >
    plus extract all between " > and </a><br>.
    Any idea? Thank you all for your help. Gada finish this project
    tonight, or I am totally screwed with my exams..:)

  • Oli Filth

    #2
    Re: Help with extracting please folks.!

    kirill_uk@hotma il.com said the following on 26/09/2005 23:34:[color=blue]
    > Help with extracting please folks.!
    > Hi. I have this:
    > a variable like: <a href="http://www.some_html.c om/text.html" >some
    > text</a><br>
    >
    > I heed to extract the "http://www.some_html.c om/text.html " and put
    > it in var "link"
    > And extract "some text" and put it var "text",.
    >
    > So basically extract all between <a href=" and " >
    > plus extract all between " > and </a><br>.
    > Any idea? Thank you all for your help. Gada finish this project
    > tonight, or I am totally screwed with my exams..:)
    >[/color]

    Please Google it.




    --
    Oli

    Comment

    • kirill_uk@hotmail.com

      #3
      Re: Help with extracting please folks.!

      Didn't fined anything useful.:((

      Comment

      • Mazin07

        #4
        Re: Help with extracting please folks.!

        kirill_uk@hotma il.com wrote:[color=blue]
        > Didn't fined anything useful.:((
        >[/color]

        Look up preg_match and preg_match_all

        Comment

        • John Dunlop

          #5
          Re: Help with extracting please folks.!

          kirill_uk wrote:
          [color=blue]
          > So basically extract all between <a href=" and " >
          > plus extract all between " > and </a><br>.[/color]

          preg_match(
          '`<a href="([^"]+)" >(.*?)</a><br>`',
          $subject,
          $output)

          Disclaimer: in case of contact with arbitrary HTML, rinse immediately.

          --
          Jock

          Comment

          Working...