Wuu Posted June 22, 2009 Report Share 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 Link to comment Share on other sites More sharing options...
bubu Posted June 22, 2009 Report Share Posted June 22, 2009 echo "http://www.bildem.lv/pfiles/5964/maxpayne.png"; Quote Link to comment Share on other sites More sharing options...
Wuu Posted June 22, 2009 Author Report Share Posted June 22, 2009 Asprātis? Quote Link to comment Share on other sites More sharing options...
werd Posted June 22, 2009 Report Share Posted June 22, 2009 Asprātis? Kas tieši bubu dotajā atbildē ir asprātīgs? Tā arī izvada tekstu! Quote Link to comment Share on other sites More sharing options...
Wuu Posted June 22, 2009 Author Report Share Posted June 22, 2009 OOo nu labi ,var close atbilde atrasta. Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted June 22, 2009 Report Share 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 Link to comment Share on other sites More sharing options...
Wuu Posted June 22, 2009 Author Report Share 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 Link to comment Share on other sites More sharing options...
marcis Posted June 22, 2009 Report Share 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 Link to comment Share on other sites More sharing options...
bubu Posted June 22, 2009 Report Share Posted June 22, 2009 To .* sākumā un beigās afaik nemaz nevajag. Quote Link to comment Share on other sites More sharing options...
marcis Posted June 22, 2009 Report Share Posted June 22, 2009 Man domāt, ka vajag gan, ja vajadzīgs tikai un vienīgi [imgl] saturs. Quote Link to comment Share on other sites More sharing options...
Wuu Posted June 22, 2009 Author Report Share 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 Link to comment Share on other sites More sharing options...
rATRIJS Posted June 22, 2009 Report Share Posted June 22, 2009 (edited) $tagToReplace = "'/\[imgl\](.*)\[\/imgl\]/iU'"; Lai dabūtu to, kas starp [imgl] Edited June 22, 2009 by rATRIJS Quote Link to comment Share on other sites More sharing options...
Wuu Posted June 22, 2009 Author Report Share 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 Link to comment Share on other sites More sharing options...
ezis Posted June 22, 2009 Report Share 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 Link to comment Share on other sites More sharing options...
Wuu Posted June 22, 2009 Author Report Share 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 Link to comment Share on other sites More sharing options...
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.