Napisałem coś takiego (wszystko działa):
<?php $max1 = stream_get_contents($aaa); $mz = '<table class="metadata plainlinks ambox ambox-style" style=""> <tr> <td class="mbox-image"> <div style="width: 52px;"><a href="/wiki/File:Text_document_with_red_question_mark.svg" class="image"><img alt="Text document with red question mark.svg" src="http://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Text_document_with_red_question_mark.svg/40px-Text_document_with_red_question_mark.svg.png" width="40" height="40" /></a></div> </td> <td class="mbox-text" style="">This article includes a <a href="/wiki/Wikipedia:Citing_sources" title="Wikipedia:Citing sources">list of references</a>, but <b>its sources remain unclear because it has insufficient <a href="/wiki/Wikipedia:Citing_sources#Adding_the_citation" title="Wikipedia:Citing sources">inline citations</a></b>.<br /> <small>Please help to <a href="/wiki/Wikipedia:WikiProject_Fact_and_Reference_Check" title="Wikipedia:WikiProject Fact and Reference Check">improve</a> this article by introducing more precise citations <a href="/wiki/Wikipedia:When_to_cite" title="Wikipedia:When to cite">where appropriate</a>. <i>(April 2009)</i></small></td> </tr> </table>'; ?>
Ale chcę to uprościć i w zmiennej $mz zamiast całości tego chcę umieścić tylko początek i koniec, a resztę zastąpić wyrażeniami regularnymi. Niestety nie mogę sobie z tym poradzić, siedzę już dłuższy czas nad tym, szukam po różnych stronach i nic z tego ;/ Aaa i do wyrażeń regularnych trzeba zamiast str_replace wziąć preg_replace, tak? Dziękuję bardzo za pomoc!
Czekając na odpowiedź siedzę nad tym dalej. Wymyśliłem coś takiego:
<?php $max1 = stream_get_contents($aaa); $mz = '/<table class="metadata plainlinks ambox ambox-style" style=""> [a-zA-Z0-9\/<>:_";,.#() [:punct:]-]where appropriate<\/a>. <i>[a-zA-Z0-9\/<>:_";,.#() [:punct:]-]<\/i><\/small><\/td> <\/tr> <\/table>/'; ?>
Niestety nie usuwa to tego fragmentu. Pewnie nie uwzględniłem jakiegoś znaku w wyrażeniach regularnych... Podpowie ktoś? Proszę