SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    Romania
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Removing portion of a string

    Hey guys,

    Given the string bellow, how can I remove all that <h5>...</h5> code?

    http://pastebin.com/m4a8a9ad4

    Thanks.

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php
    $string 
    '
    [Answering Machine Message]
    <br />
    <br />Alright There Jason....theres somebody on the telly... on 15 to 1 right now, called Adam
    <br />Perrys had sex with 3 Thousand People..... The End
    <br />
    <br />ITS A
    <br />
    <br />Buy a junk?, delay that moon?, you think we feel the need to prove
    <br />That we play the ****ing tunes, while you're the one that's ****ing you
    <br />Now if you'd ever spared a day, at these things that don't ****ing go away
    <br />You can see that our contract says that we get to do this our own way
    <br />
    <br />Who can't challenge what you do? Don't be punks!
    <br />Who can't challenge where to go? Don't be punks!
    <br />And when will we change our tune? Don't be punks!
    <br />You can't tell 'em when and much! Don't be punks!
    <br />
    <br />At this point you ****ing loser, you don't have a ****ing opinion<br /><br />
    <h5>.<img src="images/ico-phone-left.gif" alt="" /><a target="_blank" href="http://www.ringtonematcher.com/co/ringtonematcher/02/noc.asp?sid=MLlyrtop&artist=A&song=Don%27t+Be+Punks" onclick="javascript: pageTracker._trackPageview(\'/outgoing/ringtone.com\');" rel="nofollow"> Send "Don\'t Be Punks" Ringtone to your Cell </a><img src="images/ico-phone-right.gif" alt="" />.</h5>
    '
    ;
    $string preg_replace('~<h5.+</h5>~i'''$string);
    ?>
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    Romania
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's great man, thanks!


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
  •