SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot IznSe7en's Avatar
    Join Date
    Jun 2004
    Location
    Around
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Advanced String Stripping

    Hey everyone,

    Figured id go ahead and ask if i cant fix it while im researching the issue. I just want to simply take string A, and strip it down to get string B.

    PHP Code:
    $stringa '<a href=http://www.somelink.com/FILENAME>FILENAME</a>'
    And string B should look like this.

    PHP Code:
    $stringb 'FILENAME'
    Thanks a bunch to whoever replies!!!

  2. #2
    SitePoint Zealot pionar's Avatar
    Join Date
    Nov 2003
    Location
    Indianapolis
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    preg_match
    http://us3.php.net/preg_match

    and do something like:

    PHP Code:
    preg_match('/<a href=".*?">(.*?)<\/a>/i',$stringa$matches);

    $stringb $matches[1]; 
    that is if my regular expression skills aren't rusty.

  3. #3
    SitePoint Zealot IznSe7en's Avatar
    Join Date
    Jun 2004
    Location
    Around
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh, im trying to extract string B from A, dont think i mentioned that, im trying your suggested method as we speak, any other suggestions anyone?

  4. #4
    SitePoint Evangelist goughb's Avatar
    Join Date
    Sep 2000
    Location
    Chicago
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ditto P, I must add Advanced String Stripping sounds sort of like an olympic sport or maybe just an adult website or tv show.

  5. #5
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,649
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    SitePoint Zealot IznSe7en's Avatar
    Join Date
    Jun 2004
    Location
    Around
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wwb_99
    Well crap, that was easy. Hoped it would be more challenging. Thanks a million!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •