SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard Busch's Avatar
    Join Date
    Jan 2004
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Replace everything NOT between specific tags

    How can I replace everything in a string without effecting what is between specific tags?

    Basically, I have a string:

    PHP Code:
    $str 'blah blah blah <object type="application/x-shockwave-flash" ...><param ... /></object> more blah bla bloop'
    I want to only return what is between the <object> tags:
    Code:
    <object type="application/x-shockwave-flash" ...><param ... /></object>
    thanks,
    eric

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Your goal is to match the <object...</object> part of the string and return the match, it's not a replacement problem

    http://us.php.net/preg_match


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
  •