Jump to content

Heppy

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Heppy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. oh yeah, used the preg_replace()
  2. Remade the your script and use the filter version and modified it a bit and added the class="g" & id="mbb And it worked like a charm, now I get the same result as your script instead I just do it one one line of code Couldn't have done it without your regexp thou, as that was the part that made it work.
  3. Nice! Thanks alot! Worked like a charm
  4. kk, There's a list of <li> tags Some of the <li> tags has class, some of it has CLASS AND ID <li class="g"></li> <li class="g"><li> <li class="g" id="mbb50"></li> <li class="g"></li> <li class="g"></li> I want to get all the <li> elements with ONLY a class, NOT an ID.
  5. That'll only strip non allowed tags. I wish to only remove the tags with certain ID's & Class, Which I don't think strip_tags can do..
  6. Hey, I'm doing a thing for work, and I need to strip out a <li> tag from a source, The li tag looks like this: <li class="g" id="mbbDD">CONTENT HERE WITH TAGS NEWLINES ETC</li> Where the DD in ID is random Numbers so any numbers should do. <li class="g c35"> <h3 class="r"> <a href="http://www.massagestockholm.net/" class="l"><em>Massage Stockholm</em></a> </h3> <div class="s"> <em>Massage Stockholm</em> - Hitta och boka alla typer av massage i Stockholm. Enbart Bokadirekt-anslutna mass�rer. Thaimassage, Taktilmassage, Shiatsumassage <b>...</b><br> <span class="f"><cite>www.<b>massagestockholm</b>.net/</cite> - <span class="gl"><a href="http://webcache.googleusercontent.com/search?q=cache:YROKHhfXogcJ:www.massagestockholm.net/+massage+stockholm&cd=8&hl=sv&ct=clnk&gl=se&ie=UTF-8">Cachad</a></span></span> </div> </li> <li class="g c35"> <h3 class="r"> <a href="http://www.massagestockholm.net/Bookings/Default.aspx?sru=42" class="l">MASSAGEN vid Centralbadet i Stockholm - <em>Massage Stockholm</em></a> </h3> <div class="s"> <em>Massage</em> i <em>Stockholm</em> City bredvid Centralbadet Drottninggatan, boka <em>massage</em> <b>...</b><br> <span class="f"><cite>www.<b>massagestockholm</b>.net/Bookings/Default.aspx?sru...</cite> - <span class="gl"><a href="http://webcache.googleusercontent.com/search?q=cache:R8fK37N8IxAJ:www.massagestockholm.net/Bookings/Default.aspx%3Fsru%3D42+massage+stockholm&cd=9&hl=sv&ct=clnk&gl=se&ie=UTF-8">Cachad</a></span></span> </div> </li> <li class="g" id="mbb10"> <h3 class="r"> <a href="http://www.massagestockholm.net/Bookings/Default.aspx?sru=551" class="l">Kroppia - <em>Massage Stockholm</em></a> </h3> <div class="s"> <em>Massage Stockholm</em>? Rehabilitering Stockholm? Vid St Eriksplan. V�lkommen <b>...</b><br> <span class="f"><cite>www.<b>massagestockholm</b>.net/Bookings/Default.aspx?sru...</cite> - <span class="gl"><a href="http://webcache.googleusercontent.com/search?q=cache:a0T8UoaQt3IJ:www.massagestockholm.net/Bookings/Default.aspx%3Fsru%3D551+massage+stockholm&cd=10&hl=sv&ct=clnk&gl=se&ie=UTF-8">Cachad</a></span></span> </div> <div class="mbl bl"> <span class="ch c36" id="mbl10" onclick="google.x(this)"></span> <div class="mbi"> <span class="ch c36" id="mbl10" onclick="google.x(this)"></span> </div><span class="ch c36" id="mbl10" onclick="google.x(this)"><a href="#" onclick="return false" class="mblink">Visa fler resultat fr�n massagestockholm.net</a></span> </div> <div id="mbf10"></div> </li> <li class="g"> <h3 class="r"> <a href="http://www.sthlmphysique.se/" class="l"><em>Massage</em> i <em>Stockholm</em>, Vasastan - Sthlm Physique - �ven presentkort</a> </h3> <div class="s"> STHLM Physique - Erbjuder <em>massage</em> mitt i Vasastan, <em>Stockholm</em>, med certifierade terapeuter. Best�ll <em>massage</em> presentkort direkt p� hemsidan. V�lkommen!<br> <span class="f"><cite>www.sthlmphysique.se/</cite> - <span class="gl"><a href="http://webcache.googleusercontent.com/search?q=cache:1E4rvRvU_t4J:www.sthlmphysique.se/+massage+stockholm&cd=11&hl=sv&ct=clnk&gl=se&ie=UTF-8">Cachad</a> - <a href="/search?hl=sv&ie=UTF-8&q=related:www.sthlmphysique.se/+massage+stockholm&tbo=1&sa=X&ei=eiq8TOvVDIKfOtHplIcN&ved=0CEsQHzAK">Liknande</a></span></span> </div> </li> <li class="g"> adam </li> <li>abscfgef</li> <li>soh3278462378</li> <li> <a href="test.php">test</a> </li> <li> </li> This is my "solution" i've come up with but it doesn't work as I'd like. It removes the designated tag AND everything after =/... Any ideas? preg_replace('/<li class="g" id="mbb[\d]*">(.*|\s*)*<\/li>/', "", $content); //Heppy.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.