Wuu Posted June 22, 2009 Report Posted June 22, 2009 [imgl]http://www.bildem.lv/pfiles/5964/maxpayne.png[/imgl] Kā man izvadīt tekstu "http://www.bildem.lv/pfiles/5964/maxpayne.png" Quote
bubu Posted June 22, 2009 Report Posted June 22, 2009 echo "http://www.bildem.lv/pfiles/5964/maxpayne.png"; Quote
werd Posted June 22, 2009 Report Posted June 22, 2009 Asprātis? Kas tieši bubu dotajā atbildē ir asprātīgs? Tā arī izvada tekstu! Quote
Wuu Posted June 22, 2009 Author Report Posted June 22, 2009 OOo nu labi ,var close atbilde atrasta. Quote
rATRIJS Posted June 22, 2009 Report Posted June 22, 2009 Bet tu jau arī prasi kā tikai izvadīt to linku. Kam tev vispār tie bbCode`i? Vari rakstīt: $val = "[imgl]http://www.bildem.lv/pfiles/5964/maxpayne.png[/imgl]"; $search = array("[imgl]", "[/imgl]); str_replace($search, "", $val); Bet patiesībā tev droši vien vajadzētu skaīties preg_replace virzienā. Quote
Wuu Posted June 22, 2009 Author Report Posted June 22, 2009 (edited) Doma ir tādā kas es saglabāju forumā custom tāgus ,tālāk jaunumos izvadu vissu parametrus priekš portāla skata ,piemēram mazbildīti ,meta tāgus utt.. <?php $val = "xxx[imgl]http://www.bildem.lv/pfiles/5964/maxpayne.png[/imgl]yyy"; echo preg_replace('/(.*?)\[imgl\](.*?)\[\/imgl\](.*?)/', '$2', $val); ?> Sanāk šādi bet nez kapēc yyy paliek :( Edited June 22, 2009 by Wuu Quote
marcis Posted June 22, 2009 Report Posted June 22, 2009 $val = "xxx[imgl]http://www.bildem.lv/pfiles/5964/maxpayne.png[/imgl]yyy"; echo preg_replace("/.*\[imgl\](.*)\[\/imgl\].*/U", "$1", $val); Quote
bubu Posted June 22, 2009 Report Posted June 22, 2009 To .* sākumā un beigās afaik nemaz nevajag. Quote
marcis Posted June 22, 2009 Report Posted June 22, 2009 Man domāt, ka vajag gan, ja vajadzīgs tikai un vienīgi [imgl] saturs. Quote
Wuu Posted June 22, 2009 Author Report Posted June 22, 2009 (edited) Nepalīdz tāpat YY parādās :( Nav kaut kādī reg tāgi satura sākums un beigas? Un vajadzētu visu tekstu izņemt ieskaitot jaunās līnijas. <?php $val = "xx \n x \n xxx [imgl]http://www.bildem.lv/pfiles/5964/maxpayne.png[/imgl] yy \n y"; echo preg_replace("/.*\[imgl\](.*)\[\/imgl\].*/U", "$1", $val); ?> Edited June 22, 2009 by Wuu Quote
rATRIJS Posted June 22, 2009 Report Posted June 22, 2009 (edited) $tagToReplace = "'/\[imgl\](.*)\[\/imgl\]/iU'"; Lai dabūtu to, kas starp [imgl] Edited June 22, 2009 by rATRIJS Quote
Wuu Posted June 22, 2009 Author Report Posted June 22, 2009 Ja tu domā šādi tad tomēr nē :( $val = "xx \n x \n xxx [imgl]http://www.bildem.lv/pfiles/5964/maxpayne.png[/imgl] yy \n y"; $tagToReplace = "'/\[imgl\](.*)\[\/imgl\]/iU'"; echo preg_replace($tagToReplace , "$1", $val); Quote
ezis Posted June 22, 2009 Report Posted June 22, 2009 ja Tev vajadzēja no [imgl]http://www.bildem.lv/pfiles/5964/maxpayne.png[/imgl] dabūt ārā http://www.bildem.lv/pfiles/5964/maxpayne.png (cik es apratu) tad šādi? $text = '[imgl]http://www.bildem.lv/pfiles/5964/maxpayne.png[/imgl]'; $text = eregi_replace("\\[imgl]([^\\[]*)\\[/imgl\\]","\\1",$text); echo $text; Quote
Wuu Posted June 22, 2009 Author Report Posted June 22, 2009 ezis tavs kods izņēma tik imgl tagus Beidzot atradu strādājošu variantu $val = preg_replace('/\n/','',$val); $val = preg_replace('/\r\n/','',$val); $imgl = preg_replace("/.*\[imgl\](.*)\[\/imgl\].*/", "$1", $val); Izdzēš visu kas ir apkārt un izvadi tikai kas ir iekš [imgl][/imgl] tāgiem Tas ir marcis variants tik bez U galā! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.