Mikijs Posted June 17, 2008 Report Share Posted June 17, 2008 pienjemsim ka man ir strings $str="Mana mīlākā mājas lapa <a href=\"http://www.php.lv\">http://www.php.lv</a> un lapas forums atrodās <a href=\"http://www.php.lv/f\">http://www.php.lv/f</a> nāciet ciemos."; Kā lai es dabūnu pieņemsim šādu tekstu $str="Mana mīlākā mājas lapa <u>http://www.php.lv</u> un lapas forums atrodās <u>http://www.php.lv/f</u> nāciet ciemos."; Link to comment Share on other sites More sharing options...
Mikijs Posted June 17, 2008 Author Report Share Posted June 17, 2008 izmantoju sekojosho kodu bet man nesanaca ta vai ta.. $htmlbody = str_replace("<a href=\"/[^a-zA-Z0-9s]/\"", "", $htmlbody); $htmlbody = str_replace("title=\"/[^a-zA-Z0-9s]/\"", "", $htmlbody); $htmlbody = str_replace("class=\"/[^a-zA-Z0-9s]/\"", "", $htmlbody); $htmlbody = str_replace("id=\"/[^a-zA-Z0-9s]/\"", "", $htmlbody); $htmlbody = str_replace("target=\"_blank\">", "", $htmlbody); $htmlbody = str_replace("</a>", "", $htmlbody); Link to comment Share on other sites More sharing options...
Mikijs Posted June 17, 2008 Author Report Share Posted June 17, 2008 pats atrisinaju savu problemu ja nu akdam vaig $str = str_replace('</a>', '', $str); $str = preg_replace('/<a[^>]+href[^>]+>/', '', $str); Link to comment Share on other sites More sharing options...
Recommended Posts